main.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---
  2. - name: Check for tuned package
  3. command: rpm -q tuned
  4. args:
  5. warn: no
  6. register: tuned_installed
  7. changed_when: false
  8. failed_when: false
  9. - name: Tuned service setup
  10. block:
  11. - name: Set tuned OpenShift variables
  12. set_fact:
  13. openshift_tuned_guest_profile: "{{ 'atomic-guest' if openshift_is_atomic else 'virtual-guest' }}"
  14. - name: Ensure directory structure exists
  15. file:
  16. state: directory
  17. dest: '{{ tuned_etc_directory }}/{{ item.path }}'
  18. with_filetree: '{{ tuned_templates_source }}'
  19. when: item.state == 'directory'
  20. - name: Ensure files are populated from templates
  21. template:
  22. src: '{{ item.src }}'
  23. dest: '{{ tuned_etc_directory }}/{{ item.path }}'
  24. with_filetree: '{{ tuned_templates_source }}'
  25. when: item.state == 'file'
  26. - name: Make tuned use the recommended tuned profile on restart
  27. file: path=/etc/tuned/active_profile state=absent
  28. - name: Restart tuned service
  29. systemd:
  30. state: restarted
  31. daemon_reload: yes
  32. name: tuned
  33. when: tuned_installed.rc == 0 | bool