robertdebock.swap

Ansible Role Swap

This guide helps you set up swap files on your system.

GitHub GitLab Downloads Version
github gitlab downloads Version

Example Playbook

Here’s an example you can use, taken from the file molecule/default/converge.yml. It is tested whenever there’s a push, pull request, or release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.swap
      swap_files:
        - path: /my.swap
          size: 1024

To prepare your machine, use the file molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.sysctl

Further information and examples can be found in this full guide.

Role Variables

Default variable values are in defaults/main.yml:

---
# default values for swap

# Set the swappiness; default is 60 for Fedora 31.
swap_swappiness: 60

# A list of swap files to create. Each entry must have a **path** (absolute path) and **size** (in megabytes).
# swap_files:
#   - path: /my.swap
#     size: 1024

# You can disable swap if needed.
swap_enabled: true

Requirements

State of Used Roles

The following roles help prepare your system. Feel free to use other methods to do so.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab
robertdebock.sysctl Build Status GitHub Build Status GitLab

Context

This role is part of many compatible roles. You can find more details in the documentation of these roles.

Here’s a look at related roles: dependencies

Compatibility

This role has been tested on these container images:

container tags
EL 9
Debian all
Fedora all
Ubuntu all

Ansible version 2.12 or higher is needed. Tests have been conducted on:

  • The previous version.
  • The current version.
  • The development version.

If you encounter issues, please report them on GitHub.

License

This role is licensed under Apache-2.0.

Author Information

The role is created by robertdebock.

Consider sponsoring me.

Informazioni sul progetto

Configure swap files on your system.

Installa
ansible-galaxy install robertdebock.swap
Licenza
apache-2.0
Download
9.9k
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.