Added swapfile to vps

This commit is contained in:
2016-01-24 17:29:38 -05:00
parent 957299ed60
commit f46037540b

View File

@@ -69,3 +69,21 @@
- name: Add update line to update script
shell: echo apt-get update && apt-get upgrade -y && apt-get clean && apt-get autoclean && apt-get autoremove -y && apt-get update >> /etc/cron.daily/update.sh
- name: Allocate swap file
shell: fallocate -l 4G /swapfile
- name: Secure swapfile
shell: chmod 600 /swapfile
- name: Make swap file
shell: mkswap /swapfile
- name: Enable swap file
shell: swapon /swapfile
- name: Fix swappiness
shell: echo "sysctl vm.swappiness=10" >> /etc/sysctl.conf
- name: Fix cache pressure
shell: echo "sysctl vm.vfs_cache_pressure=50" >> /etc/sysctl.conf