tuned - add custom profile support, udev/io sched. example
This commit is contained in:
parent
a3cd18f090
commit
9406e7ddfb
6 changed files with 71 additions and 0 deletions
17
play.yml
17
play.yml
|
@ -1,5 +1,22 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
tuned_base_profile: "network-latency"
|
||||||
|
tuned_custom_profile:
|
||||||
|
name: tweaks
|
||||||
|
sections:
|
||||||
|
- name: main
|
||||||
|
params:
|
||||||
|
- option: summary
|
||||||
|
value: "Custom tuned profile created by jlay - virt. IO scheduler, TCP, etc"
|
||||||
|
- option: include
|
||||||
|
value: "{{ tuned_base_profile }}"
|
||||||
|
- name: disk
|
||||||
|
params:
|
||||||
|
- option: devices_udev_regex
|
||||||
|
value: "(ID_MODEL=QEMU_HARDDISK)|(ID_VENDOR=HC)"
|
||||||
|
- option: elevator
|
||||||
|
value: "mq-deadline"
|
||||||
roles:
|
roles:
|
||||||
- {role: bootstrap}
|
- {role: bootstrap}
|
||||||
- {role: tmp-mount-fix}
|
- {role: tmp-mount-fix}
|
||||||
|
|
3
roles/tuned/defaults/main.yml
Normal file
3
roles/tuned/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
tuned_base_profile: "network-latency"
|
||||||
|
tuned_custom_profile: "default-custom-profile"
|
5
roles/tuned/handlers/main.yml
Normal file
5
roles/tuned/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: restart tuned
|
||||||
|
service:
|
||||||
|
name: tuned
|
||||||
|
state: restarted
|
25
roles/tuned/tasks/configure-custom-profile.yml
Normal file
25
roles/tuned/tasks/configure-custom-profile.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# borrowed from https://github.com/giovtorres/ansible-role-tuned/
|
||||||
|
# trivially changed based on style preferences
|
||||||
|
---
|
||||||
|
- name: create custom tuned profile directory
|
||||||
|
file:
|
||||||
|
path: "/etc/tuned/{{ tuned_custom_profile.name }}"
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: copy custom profile configuration file
|
||||||
|
template:
|
||||||
|
src: custom_profile.conf.j2
|
||||||
|
dest: "/etc/tuned/{{ tuned_custom_profile.name }}/tuned.conf"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: restart tuned
|
||||||
|
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
|
|
@ -13,3 +13,12 @@
|
||||||
name: tuned
|
name: tuned
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
|
- name: get active tuned profile
|
||||||
|
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
|
||||||
|
|
12
roles/tuned/templates/custom_profile.conf.j2
Normal file
12
roles/tuned/templates/custom_profile.conf.j2
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
#
|
||||||
|
# tuned '{{ tuned_custom_profile.name }}' configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
{% for section in tuned_custom_profile.sections %}
|
||||||
|
[{{ section.name }}]
|
||||||
|
{% for item in section.params %}
|
||||||
|
{{ item.option }}={{ item.value }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue