main.yml 771 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Combine service lists for bash script
  3. set_fact:
  4. service_list: "{{ service_list | default('') +'\"' + item + '\" ' }}"
  5. with_items:
  6. - "{{ status_services }}"
  7. - "{{ status_services_extra }}"
  8. - name: Install statusservices script
  9. template:
  10. src: statusservices.j2
  11. dest: /usr/local/bin/statusservices
  12. owner: root
  13. group: root
  14. mode: '0755'
  15. when:
  16. - service_list is defined
  17. - name: Ensure root .bash_profile exists
  18. ansible.builtin.file:
  19. path: /root/.bash_profile
  20. state: file
  21. owner: root
  22. group: root
  23. mode: '0640'
  24. - name: Add statusservices to .bash_profile
  25. lineinfile:
  26. path: /root/.bash_profile
  27. line: '/usr/local/bin/statusservices'
  28. state: present
  29. when:
  30. - service_list is defined