swap: create swapfile only once
This commit is contained in:
parent
8495c555cc
commit
8de6ab833f
1 changed files with 3 additions and 2 deletions
|
@ -6,21 +6,22 @@
|
|||
file:
|
||||
path: "{{ swap_file_path }}"
|
||||
state: touch
|
||||
register: swap_touch
|
||||
|
||||
- name: On BTRFS we need NoCOW
|
||||
file:
|
||||
path: "{{ swap_file_path }}"
|
||||
attr: +C
|
||||
when: swap_touch.changed
|
||||
|
||||
- name: Create swap file
|
||||
command:
|
||||
cmd: "dd if=/dev/zero of={{ swap_file_path }} bs=1024 count={{ swap_file_size_mb }}k"
|
||||
creates: "{{ swap_file_path }}"
|
||||
when: swap_touch.changed
|
||||
tags:
|
||||
- swap.file.create
|
||||
- swap
|
||||
|
||||
|
||||
- name: Change swap file permissions
|
||||
file: path="{{ swap_file_path }}"
|
||||
owner=root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue