Execution
Date 03 Jun 2024 13:32:15 +0100
Duration 00:00:16.43
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.1
Python 3.10.10
Summary
81 Hosts
1 Tasks
81 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/RM9587-swapiness.yaml

---
- name: Playbook to modify swapiness
  hosts: all
  gather_facts: false
  tasks:
    - name: Modify swapiness
      ansible.builtin.shell: |
        set -o pipefail
        sed -i '/^vm.swappiness/ { s/=.*/=0/; b }; $a vm.swappiness=0' /etc/sysctl.conf
        sysctl -p
        cat /proc/sys/vm/swappiness
      args:
        executable: /bin/bash
      changed_when: false