Simple swap setup script for Linux
Latest commit f876733 Oct 17, 2016 @Cretezy committed on GitHub Update main.yml
Failed to load latest commit information.
ansible-swap Update main.yml Oct 17, 2016
.gitignore Added Anisble script Mar 23, 2016
LICENSE Initial commit Aug 20, 2015 Update README with new URL Oct 17, 2016 Update Sep 29, 2016


Simple swap setup script for Linux

Swap is an area on a hard drive that has been designated as a place where the operating system can temporarily store data that it can no longer hold in RAM.

Disclamer: This script may not work on every GNU/Linux distro. Sorry.


First of all, download the main script:

wget -O swap

Then simply run the file with this format:

sh swap {size}

Example (with 4G):

sh swap 4G

The default path for the swap file is /swapfile. If you wish to change this, simple the file location (file must not exist) add it to the command:

sh swap 4G /mynewswapfile


Ansible Playbook collection to make things easier and faster

Run Playbook

ansible-playbook -i '' ansible-swap/server.yml

With the server's IP.

Changes to be made as required


  1. Change location - location on your server/instance
  2. Change Memory to be allocated