DEBOPS.SWAPFILE(5)

NAME
debops.swapfile - Configure one or multiple swap files on a Linux system

SYNOPSIS

debops run service/swapfile [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

This Ansible role lets you manage one or multiple swap files. You can also manage kernel parameters related to how swap is used by the system.

Note that this role can not setup a swap file on a BTRFS filesystem.

Refer to debops.sysctl for paging and swapping related kernel settings.

GETTING STARTED

  Example inventory

To enable swap files on a host, it needs to be added to the [debops_service_swapfile] group in Ansible’s inventory:

[debops_service_swapfile]
hostname

  Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.swapfile role:

---
- name: Configure swap files
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_swapfile' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: swapfile
      tags: [ 'role::swapfile', 'skip::swapfile' ]

DEFAULT VARIABLE DETAILS

Some of debops.swapfile default variables have more extensive configuration than simple strings or lists, here you can find documentation and examples for them.

  swapfile__files

debops.swapfile can manage multiple swap files at once. This list in a simple form specifies absolute filenames of the swap files to manage.

An extended configuration can be done using a YAML dictionary for each swap file. List of recognized parameters:

path
    Required. Path of the swap file to manage.

size
    Optional. Set the size in MB of a given swap file.

priority
    Optional. Specify a priority of the swap file.

state
    Optional. If specified and absent, swap file will be disabled and deleted from the system.

  Examples

Manage two swap files at once:

swapfile__files:
  - '/swapfile0'
  - path: /swapfile1'
    size: '1024'

AUTHOR
Maciej Delmanowski, Robin Schneider

COPYRIGHT
2014-2024, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others