diff --git a/roles/powervs_configure_os_for_sap/tasks/main.yml b/roles/powervs_configure_os_for_sap/tasks/main.yml index 83db2e1..602022b 100644 --- a/roles/powervs_configure_os_for_sap/tasks/main.yml +++ b/roles/powervs_configure_os_for_sap/tasks/main.yml @@ -88,11 +88,19 @@ state: latest # to Ensure that NFS and rpcbind daemon are up. -- name: Ensure NFS client is running +- name: Ensure NFS client is running (RHEL) + ansible.builtin.service: + name: nfs-client.target + state: started + enabled: true + when: "ansible_distribution is match('RedHat*')" + +- name: Ensure NFS client is running (SLES) ansible.builtin.service: name: nfs state: started enabled: true + when: "ansible_distribution is match('SLES*')" - name: Ensure rpcbind is running ansible.builtin.service: @@ -105,17 +113,8 @@ changed_when: false # enable RFS -- name: Update /proc/sys/net/core/rps_sock_flow_entries - ansible.legacy.shell: "echo 32768 > /proc/sys/net/core/rps_sock_flow_entries" - -- name: Find all rx-* files in /sys/class/net/*/queues/ - ansible.legacy.shell: "find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/'" - register: rx_files - -- name: Update and persist all rx-* files - ansible.legacy.shell: "echo '32768' > {{ item }}/rps_flow_cnt && sync {{ item }}/rps_flow_cnt" - loop: "{{ rx_files.stdout_lines }}" - when: rx_files.stdout_lines is defined +- name: Tune RHEL for SAP + ansible.builtin.include_tasks: "rfs.yml" # sap tuning - name: Tune RHEL for SAP diff --git a/roles/powervs_configure_os_for_sap/tasks/rfs.yml b/roles/powervs_configure_os_for_sap/tasks/rfs.yml new file mode 100644 index 0000000..8b1a1e0 --- /dev/null +++ b/roles/powervs_configure_os_for_sap/tasks/rfs.yml @@ -0,0 +1,60 @@ +--- +# Ensure RFS configuration persists +- name: Configure RFS with 32768 + hosts: all + become: yes + tasks: + - name: Update rps_sock_flow_entries runtime value + ansible.builtin.shell: sysctl -w net.core.rps_sock_flow_entries=32768 + changed_when: false + + - name: Persist rps_sock_flow_entries in sysctl.conf + lineinfile: + path: /etc/sysctl.conf + regexp: '^net.core.rps_sock_flow_entries' + line: 'net.core.rps_sock_flow_entries=32768' + + - name: Reload sysctl configuration + ansible.builtin.shell: sysctl -p + + - name: Create custom systemd unit for RFS configuration + copy: + dest: /etc/systemd/system/rfs-config.service + content: | + [Unit] + Description=Set RPS flow control settings + After=network-online.target + Wants=network-online.target + + [Service] + Type=oneshot + ExecStart=/bin/bash -c "sleep 5; for file in $(find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/'); do echo 32768 > $file/rps_flow_cnt; done" + + [Install] + WantedBy=multi-user.target + + - name: Reload systemd manager configuration + ansible.builtin.shell: systemctl daemon-reload + + - name: Enable and start RFS configuration service + systemd: + name: rfs-config.service + enabled: yes + state: restarted + + - name: Verify sysctl value after service start + ansible.builtin.shell: sysctl net.core.rps_sock_flow_entries + register: sysctl_value + + - name: Debug sysctl value + debug: + var: sysctl_value.stdout + + - name: Verify RFS runtime configuration + ansible.builtin.shell: | + find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/' | xargs -I{} cat {}/rps_flow_cnt + register: rfs_runtime_values + + - name: Debug RFS runtime values + debug: + var: rfs_runtime_values.stdout_lines