summaryrefslogtreecommitdiffstats
path: root/roles/tuned/tasks/main.yml
blob: 4a28d47b24bf6f3d9560e1296bbc19798122ef66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Check for tuned package
  command: rpm -q tuned
  args:
    warn: no
  register: tuned_installed
  changed_when: false
  failed_when: false

- name: Tuned service setup
  block:
  - name: Set tuned OpenShift variables
    set_fact:
      openshift_tuned_guest_profile: "{{ 'atomic-guest' if openshift_is_atomic else 'virtual-guest' }}"

  - name: Ensure directory structure exists
    file:
      state: directory
      dest: '{{ tuned_etc_directory }}/{{ item.path }}'
    with_filetree: '{{ tuned_templates_source }}'
    when: item.state == 'directory'

  - name: Ensure files are populated from templates
    template:
      src: '{{ item.src }}'
      dest: '{{ tuned_etc_directory }}/{{ item.path }}'
    with_filetree: '{{ tuned_templates_source }}'
    when: item.state == 'file'

  - name: Make tuned use the recommended tuned profile on restart
    file: path=/etc/tuned/active_profile state=absent

  - name: Restart tuned service
    systemd:
      state: restarted
      daemon_reload: yes
      name: tuned

  when: tuned_installed.rc == 0 | bool