Moved swapfile to /mnt/swapfile

This commit is contained in:
2018-08-29 10:32:04 -04:00
parent 951c15d6ce
commit 679d68d4bf

View File

@@ -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