Skip to content

Commit 8e53ef4

Browse files
authored
Merge pull request #59 from msladek/sysctl-d
Persist swappiness in sysctl.d
2 parents f8e134c + 910c6f5 commit 8e53ef4

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ How large (in mebibytes) to make the swap file.
2424

2525
The `vm.swappiness` value to be configured in sysconfig.
2626

27+
swap_sysctl_file: /etc/sysctl.d/90-swap.conf
28+
29+
The sysctl file used to persist `vm.swappiness`.
30+
2731
swap_file_state: present
2832

2933
If you wish to _remove_ your swapfile, and disable swap, set this to `absent`. Generally you'd probably want to set this to `present`.

‎defaults/main.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
swap_file_path: /swapfile
33
swap_file_size_mb: '512'
44
swap_swappiness: '60'
5+
swap_sysctl_file: /etc/sysctl.d/90-swap.conf
56
swap_file_state: present
67
swap_file_create_command: "dd if=/dev/zero of={{ swap_file_path }} bs=1M count={{ swap_file_size_mb }}"
78

‎tasks/enable.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
name: vm.swappiness
3030
value: "{{ swap_swappiness }}"
3131
state: present
32+
sysctl_set: true
33+
sysctl_file: "{{ swap_sysctl_file }}"

0 commit comments

Comments
 (0)