tuned: release-dependent profile basedir, lint
This commit is contained in:
parent
0c33dccba8
commit
c475723f52
4 changed files with 35 additions and 25 deletions
|
@ -1,3 +1,5 @@
|
||||||
---
|
---
|
||||||
tuned_base_profile: "network-latency"
|
tuned_base_profile: "network-latency"
|
||||||
tuned_custom_profile: "default-custom-profile"
|
tuned_custom_profile: "default-custom-profile"
|
||||||
|
# profiles are expected in a subdirectory past 2.23.0; default using package facts
|
||||||
|
tuned_amdgpu_profile_dir: "{{ '/etc/tuned' if ansible_facts['packages']['tuned'][0]['version'] is version('2.23.0', '<') else '/etc/tuned/profiles' }}"
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: restart tuned
|
- name: Restart
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: tuned
|
name: tuned
|
||||||
state: restarted
|
state: restarted
|
||||||
|
become: true
|
||||||
|
listen: tuned_restart
|
||||||
|
|
||||||
- name: enable tuned profile
|
- name: Enable Profile
|
||||||
command: "/usr/sbin/tuned-adm profile {{ tuned_custom_profile.name }}"
|
ansible.builtin.command: "/usr/sbin/tuned-adm profile {{ tuned_custom_profile.name }}"
|
||||||
|
become: true
|
||||||
|
changed_when: true # handler, assumed this would be making/realizing changes
|
||||||
|
listen: tuned_enable
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
---
|
---
|
||||||
- name: create custom tuned profile directory
|
- name: Ensure profile directory
|
||||||
become: true
|
become: true
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/tuned/{{ tuned_custom_profile.name }}"
|
path: "{{ (tuned_amdgpu_profile_dir, tuned_custom_profile.name) | path_join }}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0755
|
mode: '0755'
|
||||||
|
|
||||||
- name: copy custom profile configuration file
|
- name: Profile configuration
|
||||||
become: true
|
become: true
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: custom_profile.conf.j2
|
src: custom_profile.conf.j2
|
||||||
dest: "/etc/tuned/{{ tuned_custom_profile.name }}/tuned.conf"
|
dest: "{{ (tuned_amdgpu_profile_dir, tuned_custom_profile.name, 'tuned.conf') | path_join }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: '0644'
|
||||||
notify:
|
notify:
|
||||||
- restart tuned
|
- tuned_restart
|
||||||
- enable tuned profile
|
- tuned_enable
|
||||||
register: tuned_custom_profile_template
|
register: tuned_custom_profile_template
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: update apt caches
|
- name: Update apt caches
|
||||||
become: true
|
become: true
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
when: (ansible_os_family in ["Debian"] )
|
when: (ansible_os_family in ["Debian"] )
|
||||||
|
|
||||||
- name: install packages
|
- name: Install packages
|
||||||
become: true
|
become: true
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
|
@ -16,20 +16,23 @@
|
||||||
- tuned-utils
|
- tuned-utils
|
||||||
# - tuned-profiles-realtime # only on Fedora? not on centos 8 stream
|
# - tuned-profiles-realtime # only on Fedora? not on centos 8 stream
|
||||||
|
|
||||||
- name: start service
|
- name: Gather Package Facts # 'tuned' release determines profile location
|
||||||
|
ansible.builtin.package_facts:
|
||||||
|
|
||||||
|
- name: Start service
|
||||||
become: true
|
become: true
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: tuned
|
name: tuned
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: get active tuned profile
|
- name: Get active tuned profile
|
||||||
become: true
|
become: true
|
||||||
command: /usr/sbin/tuned-adm active
|
ansible.builtin.command: /usr/sbin/tuned-adm active
|
||||||
register: tuned_active
|
register: tuned_active
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: deploy custom tuned profiles
|
- name: Deploy custom tuned profiles
|
||||||
include_tasks: configure-custom-profile.yml
|
ansible.builtin.include_tasks: configure-custom-profile.yml
|
||||||
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)
|
when: not ansible_local.os.is_atomic
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue