tuned: make more robust, add become
This commit is contained in:
parent
b42c53e50b
commit
873d670016
3 changed files with 20 additions and 14 deletions
|
@ -3,3 +3,6 @@
|
||||||
service:
|
service:
|
||||||
name: tuned
|
name: tuned
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
- name: enable tuned profile
|
||||||
|
command: "/usr/sbin/tuned-adm profile {{ tuned_custom_profile.name }}"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: create custom tuned profile directory
|
- name: create custom tuned profile directory
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: "/etc/tuned/{{ tuned_custom_profile.name }}"
|
path: "/etc/tuned/{{ tuned_custom_profile.name }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
@ -8,16 +9,14 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: copy custom profile configuration file
|
- name: copy custom profile configuration file
|
||||||
|
become: true
|
||||||
template:
|
template:
|
||||||
src: custom_profile.conf.j2
|
src: custom_profile.conf.j2
|
||||||
dest: "/etc/tuned/{{ tuned_custom_profile.name }}/tuned.conf"
|
dest: "/etc/tuned/{{ tuned_custom_profile.name }}/tuned.conf"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart tuned
|
notify:
|
||||||
|
- restart tuned
|
||||||
|
- enable tuned profile
|
||||||
register: tuned_custom_profile_template
|
register: tuned_custom_profile_template
|
||||||
|
|
||||||
- name: set custom tuned profile
|
|
||||||
command: "/usr/sbin/tuned-adm profile {{ tuned_custom_profile.name }}"
|
|
||||||
when:
|
|
||||||
- tuned_custom_profile_template is changed
|
|
||||||
|
|
|
@ -1,31 +1,35 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: update apt caches
|
- name: update apt caches
|
||||||
|
become: true
|
||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
update_cache: true
|
||||||
when: (ansible_os_family in ["Debian"] )
|
when: (ansible_os_family in ["Debian"] )
|
||||||
|
|
||||||
- name: install packages
|
- name: install packages
|
||||||
|
become: true
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: latest
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- tuned
|
- tuned
|
||||||
- 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: start service
|
||||||
|
become: true
|
||||||
service:
|
service:
|
||||||
name: tuned
|
name: tuned
|
||||||
enabled: yes
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: get active tuned profile
|
- name: get active tuned profile
|
||||||
|
become: true
|
||||||
command: /usr/sbin/tuned-adm active
|
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 {{ tuned_custom_profile }} based on {{ tuned_base_profile }}
|
- name: deploy custom tuned profiles
|
||||||
include: configure-custom-profile.yml
|
include_tasks: configure-custom-profile.yml
|
||||||
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)
|
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)
|
||||||
|
|
Loading…
Reference in a new issue