tuned: discover base profiles dynamically

This commit is contained in:
Josh Lay 2024-08-09 08:25:54 -05:00
parent 983d2339f2
commit 2d314fd691
No known key found for this signature in database
GPG key ID: 47AA304B2243B579
3 changed files with 22 additions and 21 deletions

View file

@ -27,6 +27,24 @@
state: present
become: true
- name: Find bundled 'tuned' profiles
ansible.builtin.find:
paths:
- /usr/lib/tuned/ # this may change/benefit from var/defaults; packaging should generally prefer this path
patterns:
- 'tuned.conf'
recurse: true
register: tuned_bundled_configs
- name: Set fact with included profile names
ansible.builtin.set_fact:
base_profiles: "{{ base_profiles | default([]) + profile_name }}"
loop: "{{ tuned_bundled_configs.files }}"
loop_control:
label: "{{ profile_name }}"
vars:
profile_name: "{{ [item.path | dirname | basename] }}"
- name: Ensure dynamic tuning is disabled
ansible.builtin.lineinfile:
path: /etc/tuned/tuned-main.conf