main.yml 993 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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: Ensure directory structure exists
  12. file:
  13. state: directory
  14. dest: '{{ tuned_etc_directory }}/{{ item.path }}'
  15. with_filetree: '{{ tuned_templates_source }}'
  16. when: item.state == 'directory'
  17. - name: Ensure files are populated from templates
  18. template:
  19. src: '{{ item.src }}'
  20. dest: '{{ tuned_etc_directory }}/{{ item.path }}'
  21. with_filetree: '{{ tuned_templates_source }}'
  22. when: item.state == 'file'
  23. - name: Make tuned use the recommended tuned profile on restart
  24. file:
  25. path: '{{ item }}'
  26. state: absent
  27. with_items:
  28. - /etc/tuned/active_profile
  29. - /etc/tuned/profile_mode
  30. - name: Restart tuned service
  31. systemd:
  32. state: restarted
  33. daemon_reload: yes
  34. name: tuned
  35. when: tuned_installed.rc == 0 | bool