From 15f179771df54e4e5dc430ebac94e37b0b38bc02 Mon Sep 17 00:00:00 2001 From: Kevin Velarde Date: Mon, 9 Nov 2026 08:26:35 -0700 Subject: [PATCH 1/2] Set tuned profile directory based on major OS version --- roles/mongodb/tasks/disable-thp.yml | 7 +++++-- roles/redis/tasks/disable-thp.yml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/mongodb/tasks/disable-thp.yml b/roles/mongodb/tasks/disable-thp.yml index 2de7c2be..18e0cb6c 100644 --- a/roles/mongodb/tasks/disable-thp.yml +++ b/roles/mongodb/tasks/disable-thp.yml @@ -61,11 +61,14 @@ - name: Install and configure tuned when: ansible_distribution_file_variety == "RedHat" + vars: + # TuneD 2.27 (EL10) only searches /etc/tuned/profiles for custom profiles + mongodb_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version == '10' else '/etc/tuned' }}/virtual-guest-no-thp" block: - name: Create custom tuned profile directory ansible.builtin.file: state: directory - path: "/etc/tuned/virtual-guest-no-thp" + path: "{{ mongodb_tuned_profile_dir }}" owner: root group: root mode: "0755" @@ -73,7 +76,7 @@ - name: Ensure tuned does not re-enable THP ansible.builtin.template: src: tuned.conf.j2 - dest: "/etc/tuned/virtual-guest-no-thp/tuned.conf" + dest: "{{ mongodb_tuned_profile_dir }}/tuned.conf" owner: root group: root mode: "0644" diff --git a/roles/redis/tasks/disable-thp.yml b/roles/redis/tasks/disable-thp.yml index 1a1561a3..9a06e47f 100644 --- a/roles/redis/tasks/disable-thp.yml +++ b/roles/redis/tasks/disable-thp.yml @@ -69,11 +69,14 @@ when: - ansible_distribution_file_variety == "RedHat" - tuned_installed.rc == 0 + vars: + # TuneD 2.27 (EL10) only searches /etc/tuned/profiles for custom profiles + redis_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version == '10' else '/etc/tuned' }}/virtual-guest-no-thp" block: - name: Create custom tuned profile directory ansible.builtin.file: state: directory - path: "/etc/tuned/virtual-guest-no-thp" + path: "{{ redis_tuned_profile_dir }}" owner: root group: root mode: "0755" @@ -81,7 +84,7 @@ - name: Ensure tuned does not re-enable THP ansible.builtin.template: src: tuned.conf.j2 - dest: "/etc/tuned/virtual-guest-no-thp/tuned.conf" + dest: "{{ redis_tuned_profile_dir }}/tuned.conf" owner: root group: root mode: "0644" From d7362716e731518389ca5a898a3bd21382c531d9 Mon Sep 17 00:00:00 2001 From: Kevin Velarde Date: Mon, 9 Nov 2026 19:47:42 -0700 Subject: [PATCH 2/2] Make EL10 version checks forward-compatible --- roles/mongodb/tasks/disable-thp.yml | 2 +- roles/mongodb/tasks/enable-thp.yml | 2 +- roles/mongodb/tasks/install-mongodb.yml | 2 +- roles/redis/tasks/disable-thp.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/mongodb/tasks/disable-thp.yml b/roles/mongodb/tasks/disable-thp.yml index 18e0cb6c..231121b2 100644 --- a/roles/mongodb/tasks/disable-thp.yml +++ b/roles/mongodb/tasks/disable-thp.yml @@ -63,7 +63,7 @@ when: ansible_distribution_file_variety == "RedHat" vars: # TuneD 2.27 (EL10) only searches /etc/tuned/profiles for custom profiles - mongodb_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version == '10' else '/etc/tuned' }}/virtual-guest-no-thp" + mongodb_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version is version('10', '>=') else '/etc/tuned' }}/virtual-guest-no-thp" block: - name: Create custom tuned profile directory ansible.builtin.file: diff --git a/roles/mongodb/tasks/enable-thp.yml b/roles/mongodb/tasks/enable-thp.yml index 6869f835..1f50761e 100644 --- a/roles/mongodb/tasks/enable-thp.yml +++ b/roles/mongodb/tasks/enable-thp.yml @@ -53,7 +53,7 @@ when: ansible_distribution_file_variety == "RedHat" vars: # TuneD 2.27 (EL10) only searches /etc/tuned/profiles for custom profiles - mongodb_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version == '10' else '/etc/tuned' }}/virtual-guest-no-thp" + mongodb_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version is version('10', '>=') else '/etc/tuned' }}/virtual-guest-no-thp" block: - name: Create custom tuned profile directory ansible.builtin.file: diff --git a/roles/mongodb/tasks/install-mongodb.yml b/roles/mongodb/tasks/install-mongodb.yml index 43c0a9ee..65349165 100644 --- a/roles/mongodb/tasks/install-mongodb.yml +++ b/roles/mongodb/tasks/install-mongodb.yml @@ -63,7 +63,7 @@ - ansible_facts.selinux.status == 'enabled' - ansible_facts.selinux.mode == 'enforcing' # EL10 selinux-policy has no MongoDB domain (mongod_t), so there is nothing to extend - - ansible_distribution_major_version != '10' + - ansible_distribution_major_version is version('10', '<') - name: Configure logrotate for MongoDB ansible.builtin.include_tasks: diff --git a/roles/redis/tasks/disable-thp.yml b/roles/redis/tasks/disable-thp.yml index 9a06e47f..3d083c53 100644 --- a/roles/redis/tasks/disable-thp.yml +++ b/roles/redis/tasks/disable-thp.yml @@ -71,7 +71,7 @@ - tuned_installed.rc == 0 vars: # TuneD 2.27 (EL10) only searches /etc/tuned/profiles for custom profiles - redis_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version == '10' else '/etc/tuned' }}/virtual-guest-no-thp" + redis_tuned_profile_dir: "{{ '/etc/tuned/profiles' if ansible_distribution_major_version is version('10', '>=') else '/etc/tuned' }}/virtual-guest-no-thp" block: - name: Create custom tuned profile directory ansible.builtin.file: