viasite-ansible.swapfile
ansible-swapfile
This tool sets up a swapfile on your system, which is a space used to extend your computer's memory. The default size it creates is 512MB.
Dependencies
There are no additional tools required.
Variables
swapfile_use_dd
(default:False
): If set to False, the swapfile is created using a method calledfallocate
. If set to True, it usesdd
. You might need to usedd
if your system doesn't supportfallocate
.swapfile_size
(default:512MB
): This defines the size of the swapfile. You can specify this in various units like MB or GB. Ifswapfile_use_dd
is set to True, give the size in megabytes (e.g.,512
).swapfile_location
(default:/swapfile
): This is where the swapfile will be created on your system.
Optional Settings
These settings are off by default and won't change anything unless you set them to a value other than False
. If you do, they will adjust the system’s memory settings.
swapfile_swappiness
(default:False
): This controls how often your system swaps out memory pages. A lower number means less swapping.swapfile_vfs_cache_pressure
(default:False
): This percentage affects how the system manages memory used for caching certain objects.
How to Use
You can include this in your Ansible playbook like this:
- hosts: all
roles:
- viasite-ansible.swapfile
Or specify settings directly:
- hosts: all
roles:
- { role: viasite-ansible.swapfile, swapfile_size: 1GB, swapfile_swappiness: 10, swapfile_location: /mnt/swapfile }
You can also define these variables in group_vars
or host_vars
.
License
This software is licensed under the MIT License.
Copyright (c) 2014 Kamal Nasser hello@kamal.io
You are allowed to use, copy, modify, and distribute this software for free, as long as you include the copyright notice and this permission notice in any copies of the software that you distribute.
The software is provided "AS IS", without any warranty. The creators are not responsible for any issues that arise from using it.
ansible-galaxy install viasite-ansible.swapfile