add 'power-profiles-daemon' handling, swap on F35+

This commit is contained in:
Josh Lay 2022-06-07 21:15:31 -05:00
parent 914e8185d5
commit 77e268ed24
Signed by: jlay
GPG key ID: B265E45CACAD108A

View file

@ -31,6 +31,25 @@
name: tuned name: tuned
state: restarted state: restarted
tasks: tasks:
- name: Gather package facts
ansible.builtin.package_facts:
manager: auto
- name: replace 'power-profiles-daemon' with 'tuned' on Fedora 35+
dnf: # use with_items since 'dnf' module in Ansible doesn't support 'swap'
name: "{{ item.name }}"
state: "{{ item.state }}"
with_items:
- {name: 'power-profiles-daemon', state: 'absent'}
- {name: 'tuned', state: 'present'}
when: ('power-profiles-daemon' in ansible_facts.packages) or (('tuned' not in ansible_facts.packages) and ((ansible_distribution == 'Fedora') and (ansible_distribution_major_version|int > 35)))
register: fed_ppdtuned_swap
# 'power-profiles-daemon' was added/conflicts with 'tuned' since F35
# otherwise, ensure the 'tuned' package is installed
- name: install tuned
package:
name: tuned
state: present
when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages)
- name: find hwmon/max power capability file for {{ card }} - name: find hwmon/max power capability file for {{ card }}
find: find:
paths: /sys/class/drm/{{ card }}/device/hwmon paths: /sys/class/drm/{{ card }}/device/hwmon
@ -44,10 +63,6 @@
slurp: slurp:
src: "{{ hwmon.files.0.path }}" src: "{{ hwmon.files.0.path }}"
register: power_max_b64 register: power_max_b64
- name: ensure tuned is installed
package:
name: tuned
state: present
- name: create custom profile directories - name: create custom profile directories
file: file:
state: directory state: directory