mullholland.swap
Ansible role swap
Configure swapfile
| GitHub | Downloads | Version |
|---|---|---|
Example Playbook
This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.
---
- name: Converge
hosts: all
become: true
gather_facts: true
pre_tasks:
- name: show virtualization type fot Ansible role testing
ansible.builtin.debug:
msg: "{{ ansible_virtualization_type }}"
roles:
- role: "mullholland.swap"
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:
---
- name: Prepare
hosts: all
become: true
gather_facts: true
tasks:
- name: Fedora | Install util-linux for fallocate
ansible.builtin.package:
name: "util-linux"
state: present
when: ansible_distribution == "Fedora"
Role Variables
The default values for the variables are set in defaults/main.yml:
---
swap_file_name: "swap" # Filename of the swapfile
swap_file_path: "/" # Path of the swap (Path needs an "/" at the end)
swap_file_size: "1024" # Size in MB
swap_file_state: "present" # Either "present" or "absent"
# create the swapfile with:
# - "fallocate"
# - "dd"
swap_create: "fallocate"
# Configure swappiness
# if variable is empty nothing will be changed on the system
swap_swappiness: ""
# swap_vfs_cache_pressure
# if variable is empty nothing will be changed on the system
swap_vfs_cache_pressure: ""
Requirements
- pip packages listed in requirements.txt.
Context
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:

Compatibility
This role has been tested on these container images:
| container | tags |
|---|---|
| EL | all |
| Amazon | Candidate |
| Fedora | all |
| Ubuntu | all |
| Debian | all |
The minimum version of Ansible required is 2.10, tests have been done to:
- The previous version.
- The current version.
- The development version.
If you find issues, please register them in GitHub.
License
MIT.
Author Information
Install
ansible-galaxy install mullholland.swapLicense
apache-2.0
Downloads
102
Owner
