File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1313
1414 tasks :
1515 - name : Check if swap file exists
16- stat :
16+ ansible.builtin. stat :
1717 path : ' {{ swap_file_path }}'
1818 register : swap_file_check
1919
2020 - name : Create swap file
21- ansible.builtin.command : fallocate -l "{{ swap_file_size }}" "{{ swap_file_path }}"
22- when : not swap_file_check.stat.exists
21+ ansible.builtin.command :
22+ cmd : fallocate -l "{{ swap_file_size }}" "{{ swap_file_path }}"
23+ creates : ' {{ swap_file_path }}'
2324
2425 - name : Set up swap file permissions
2526 ansible.builtin.file :
2829 group : root
2930 mode : ' 0600'
3031
31- - name : Prepare the swap file
32+ - name : Prepare the swap file # noqa: no-changed-when
33+ # we already have a check in `when`, no need for warning
3234 ansible.builtin.command : mkswap "{{ swap_file_path }}"
3335 when : not swap_file_check.stat.exists
3436
4244 dump : 0
4345 state : present
4446
45- - name : Enable swap
46- command : swapon -a
47+ - name : Enable swap # noqa: no-changed-when
48+ # we already have a check in `when`, no need for warning
49+ ansible.builtin.command : swapon -a
4750 when : not swap_file_check.stat.exists
4851
4952 - name : Enable swappiness
50- sysctl :
53+ ansible.posix. sysctl :
5154 name : vm.swappiness
5255 value : 1
You can’t perform that action at this time.
0 commit comments