diff --git a/roles/common/tasks/swap.yml b/roles/common/tasks/swap.yml index 7c68b04..6dbe868 100644 --- a/roles/common/tasks/swap.yml +++ b/roles/common/tasks/swap.yml @@ -1,6 +1,6 @@ --- - name: test for swap partition - shell: swapon -s | grep -E "^/swapfile" + shell: swapon -s | grep -E "^/mnt/swapfile" register: swapfile ignore_errors: yes @@ -17,32 +17,32 @@ - name: create swapfile when: swapfile|failed - shell: fallocate -l 4G /swapfile + shell: fallocate -l 4G /mnt/swapfile ignore_errors: yes - name: set swapfile permissions when: swapfile|failed - file: path=/swapfile + file: path=/mnt/swapfile owner=root group=root mode=0600 - name: prepare swapfile when: swapfile|failed - shell: mkswap /swapfile + shell: mkswap /mnt/swapfile ignore_errors: yes - name: enable swap when: swapfile|failed - shell: swapon /swapfile + shell: swapon /mnt/swapfile ignore_errors: yes - name: add swapfile when: swapfile|failed lineinfile: dest=/etc/fstab - regexp="^/swapfile" + regexp="^/mnt/swapfile" state=present - line="/swapfile none swap sw 0 0" + line="/mnt/swapfile none swap sw 0 0" - name: set swappiness (temporarily) when: swapfile|failed