linting clean up
This commit is contained in:
parent
40028e5229
commit
23f0ad541d
2 changed files with 24 additions and 23 deletions
|
@ -46,4 +46,4 @@ gpu_clock_max: "2500" # default 2529
|
||||||
gpumem_clock_max: "1050"
|
gpumem_clock_max: "1050"
|
||||||
#
|
#
|
||||||
# optional, applies offset to GPU voltage, eg: '+100' = to boost GPU core voltage 100mV or 0.1V. for the 'custom' GPU profile.
|
# optional, applies offset to GPU voltage, eg: '+100' = to boost GPU core voltage 100mV or 0.1V. for the 'custom' GPU profile.
|
||||||
#gpu_mv_offset: "+50"
|
# gpu_mv_offset: "+50"
|
||||||
|
|
43
playbook.yml
43
playbook.yml
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
|
name: "Configure 'tuned' with AMD GPU control"
|
||||||
become: true
|
become: true
|
||||||
vars:
|
vars:
|
||||||
# list of source tuned profiles available on Fedora (TODO: should dynamically discover)
|
# list of source tuned profiles available on Fedora (TODO: should dynamically discover)
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
- powersave
|
- powersave
|
||||||
- virtual-host
|
- virtual-host
|
||||||
handlers:
|
handlers:
|
||||||
- name: restart tuned
|
- name: Restart tuned
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: tuned
|
name: tuned
|
||||||
state: restarted
|
state: restarted
|
||||||
|
@ -21,8 +22,8 @@
|
||||||
- name: Gather package facts
|
- name: Gather package facts
|
||||||
ansible.builtin.package_facts:
|
ansible.builtin.package_facts:
|
||||||
manager: auto
|
manager: auto
|
||||||
- name: replace 'power-profiles-daemon' with 'tuned' on Fedora 35+
|
- name: Replace 'power-profiles-daemon' with 'tuned' on Fedora 35+
|
||||||
dnf: # use with_items since 'dnf' module in Ansible doesn't support 'swap'
|
ansible.builtin.package: # use with_items/pkg since 'dnf' module in Ansible doesn't support 'swap'
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
state: "{{ item.state }}"
|
state: "{{ item.state }}"
|
||||||
with_items:
|
with_items:
|
||||||
|
@ -35,19 +36,19 @@
|
||||||
register: fed_ppdtuned_swap
|
register: fed_ppdtuned_swap
|
||||||
# 'power-profiles-daemon' was added/conflicts with 'tuned' since F35
|
# 'power-profiles-daemon' was added/conflicts with 'tuned' since F35
|
||||||
# otherwise, ensure the 'tuned' package is installed
|
# otherwise, ensure the 'tuned' package is installed
|
||||||
- name: install tuned
|
- name: Install tuned
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: tuned
|
name: tuned
|
||||||
state: present
|
state: present
|
||||||
when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages)
|
when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages)
|
||||||
- name: determine GPU device in drm subsystem
|
- name: Determine GPU device in drm subsystem
|
||||||
shell:
|
ansible.builtin.shell:
|
||||||
cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | sort -h | tail -1
|
cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | sort -h | tail -1
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: card
|
register: card
|
||||||
- name: find hwmon/max power capability file for {{ card.stdout }}
|
- name: Find hwmon/max power capability file for {{ card.stdout }}
|
||||||
find:
|
ansible.builtin.find:
|
||||||
paths: /sys/class/drm/{{ card.stdout }}/device/hwmon
|
paths: /sys/class/drm/{{ card.stdout }}/device/hwmon
|
||||||
file_type: file
|
file_type: file
|
||||||
recurse: true
|
recurse: true
|
||||||
|
@ -55,8 +56,8 @@
|
||||||
patterns:
|
patterns:
|
||||||
- '^power1_cap_max$'
|
- '^power1_cap_max$'
|
||||||
register: hwmon
|
register: hwmon
|
||||||
- name: find hwmon/current power limit file for {{ card.stdout }}
|
- name: Find hwmon/current power limit file for {{ card.stdout }}
|
||||||
find:
|
ansible.builtin.find:
|
||||||
paths: /sys/class/drm/{{ card.stdout }}/device/hwmon
|
paths: /sys/class/drm/{{ card.stdout }}/device/hwmon
|
||||||
file_type: file
|
file_type: file
|
||||||
recurse: true
|
recurse: true
|
||||||
|
@ -64,20 +65,20 @@
|
||||||
patterns:
|
patterns:
|
||||||
- '^power1_cap$'
|
- '^power1_cap$'
|
||||||
register: powercap_set
|
register: powercap_set
|
||||||
- name: get max power capability for {{ card.stdout }}
|
- name: Get max power capability for {{ card.stdout }}
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ hwmon.files.0.path }}"
|
src: "{{ hwmon.files.0.path }}"
|
||||||
register: power_max_b64
|
register: power_max_b64
|
||||||
- name: create custom profile directories
|
- name: Create custom profile directories
|
||||||
file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}
|
path: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
- name: template AMDGPU control/reset scripts
|
- name: Template AMDGPU control/reset scripts
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: templates/amdgpu-clock.sh.j2
|
src: templates/amdgpu-clock.sh.j2
|
||||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/amdgpu-clock.sh
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/amdgpu-clock.sh
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -87,8 +88,8 @@
|
||||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
notify: restart tuned
|
notify: restart tuned
|
||||||
- name: template custom tuned profiles
|
- name: Template custom tuned profiles
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: templates/tuned.conf.j2
|
src: templates/tuned.conf.j2
|
||||||
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/tuned.conf
|
dest: /etc/tuned/{{ item.1 }}-amdgpu-{{ item.0.key }}/tuned.conf
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -98,7 +99,7 @@
|
||||||
- "{{ lookup('dict', amdgpu_profiles) }}"
|
- "{{ lookup('dict', amdgpu_profiles) }}"
|
||||||
- "{{ base_profiles }}"
|
- "{{ base_profiles }}"
|
||||||
notify: restart tuned
|
notify: restart tuned
|
||||||
- name: ensure tuned is enabled
|
- name: Ensure tuned is enabled
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: tuned
|
name: tuned
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
Loading…
Reference in a new issue