tuned: make more robust, add become

This commit is contained in:
Josh Lay 2023-08-30 20:30:26 -05:00
parent b42c53e50b
commit 873d670016
Signed by: jlay
GPG key ID: B265E45CACAD108A
3 changed files with 20 additions and 14 deletions

View file

@ -1,31 +1,35 @@
---
- name: update apt caches
become: true
apt:
update_cache: yes
update_cache: true
when: (ansible_os_family in ["Debian"] )
- name: install packages
become: true
package:
name: "{{ item }}"
state: latest
state: present
with_items:
- tuned
- tuned-utils
# - tuned-profiles-realtime # only on Fedora? not on centos 8 stream
- tuned
- tuned-utils
# - tuned-profiles-realtime # only on Fedora? not on centos 8 stream
- name: start service
become: true
service:
name: tuned
enabled: yes
enabled: true
state: started
- name: get active tuned profile
become: true
command: /usr/sbin/tuned-adm active
register: tuned_active
changed_when: false
ignore_errors: true
- name: deploy {{ tuned_custom_profile }} based on {{ tuned_base_profile }}
include: configure-custom-profile.yml
- name: deploy custom tuned profiles
include_tasks: configure-custom-profile.yml
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)