mullholland.sysctl

Ansible role sysctl

Configure sysctl settings

GitHub Downloads Version
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
  vars:
    sysctl_settings:
      - name: "vm.swappiness"
        value: 10
        state: "present"
        reload: "true"
        ignoreerrors: false
        sysctl_file: "/etc/sysctl.conf"
        sysctl_set: true
      - name: vm.vfs_cache_pressure
        value: 50
      - name: "net.ipv4.ip_forward"
        value: 1

  pre_tasks:
    - name: show virtualization type fot Ansible role testing
      ansible.builtin.debug:
        msg: "{{ ansible_virtualization_type }}"

  roles:
    - role: "mullholland.sysctl"

Role Variables

The default values for the variables are set in defaults/main.yml:

---
sysctl_settings: []
#  - name: "vm.swappiness"            # required
#    value: 10                        # required
#    state: "present"                 # optional => default('present')
#    reload: "true"                   # optional => default('true')
#    ignoreerrors: false              # optional => default('false')
#    sysctl_file: "/etc/sysctl.conf"  # optional => default('/etc/sysctl.conf')
#    sysctl_set: true                 # optional => default('false')
#  - name: vm.vfs_cache_pressure
#    value: 50
#  - name: "net.ipv4.ip_forward"
#    value: 1

Requirements

State of used roles

The following roles are used to prepare a system. You can prepare your system in another way.

Requirement GitHub GitLab

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: dependencies

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

Mullholland

Install
ansible-galaxy install mullholland.sysctl
GitHub repository
License
apache-2.0
Downloads
107