swap
is an ansible role which:
- installs swap file
- configures swap
Used i.e. with digital ocean droplets.
NOTE: Travis currently fails due to permission errors as you can't create swap files.
Using ansible-galaxy
:
$ ansible-galaxy install franklinkim.swap
Using requirements.yml
:
- src: franklinkim.swap
Using git
:
$ git clone https://github.com/weareinteractive/ansible-swap.git franklinkim.swap
- Ansible >= 1.9
Here is a list of all the default variables for this role, which are also available in defaults/main.yml
.
# swap file path
swap_file_path: /swapfile
# swap file size in bytes
swap_file_size: "{{ 512 * 1024 * 1024 }}" # 512MB
# Configures how often your system swaps data out of RAM to the
# swap space. This is a value between 0 and 100 that represents a percentage
swap_swappiness: 10
# This setting configures how much the system will
# choose to cache inode and dentry information over other data
swap_vfs_scache_pressure: 50
These are the handlers that are defined in handlers/main.yml
.
restart swap
- hosts: all
roles:
- franklinkim.swap
vars:
swap_file_size: "{{ 128 * 1024 * 1024 }}" # 128MB
- hosts: all
roles:
- franklinkim.swap
vars:
swap_file_size: "{{ 256 * 1024 * 1024 }}" # 256MB
$ git clone https://github.com/weareinteractive/ansible-swap.git
$ cd ansible-swap
$ vagrant up
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright (c) We Are Interactive under the MIT license.