Execution
Date 18 Dec 2025 11:06:21 +0000
Duration 00:17:13.55
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
325 Hosts
1 Tasks
325 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM10126-VM-tuned-install.yaml

---
- name: Playbook to install and config tuned on VMs
  hosts: all,!phase15
  gather_facts: false
  tasks:
    - name: Install
      ansible.builtin.shell: |
        set -o pipefail
        dnf clean all
        dnf -y install tuned
        systemctl enable --now tuned.service
        sed -i 's/vm.swappiness=0/# vm.swappiness=0/g' /etc/sysctl.conf
        mkdir -p /etc/tuned/ls-vm-tweaks/
        mv /etc/tuned/ls-vm-tweaks/tuned.conf /etc/tuned/ls-vm-tweaks/tuned.conf-bak-$(date +%s)
        cat > /etc/tuned/ls-vm-tweaks/tuned.conf << EOF
        [main]
        summary=LS VM optimized profile

        [sysctl]
        vm.dirty_ratio = 30
        vm.dirty_background_ratio = 10
        vm.swappiness = 1
        vm.force_cgroup_v2_swappiness = 1
        net.core.somaxconn = 4096
        net.ipv6.ip_nonlocal_bind = 1

        [scheduler]
        runtime=0
        sched_min_granularity_ns = 10000000
        sched_wakeup_granularity_ns = 15000000
        EOF
        tuned-adm off
        tuned-adm profile ls-vm-tweaks
        tuned-adm active | grep ls-vm-tweaks && echo "Profile ls-vm-tweaks is active" || echo "Profile ls-vm-tweaks is not active"
      args:
        executable: /bin/bash
      changed_when: false