main.yml 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. ---
  2. - fail: msg="This system should not be monitored"
  3. when: monitored_dont is defined
  4. - fail: msg="Neither monitored_by_(ssh|nrpe) is set"
  5. when: monitored_by_nrpe == False and monitored_by_ssh == False
  6. - name: Gather OS Specific Variables
  7. include_vars: "{{ item }}"
  8. with_first_found:
  9. - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_version|lower).split(' ')[0] }}.yml"
  10. - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_major_version|lower).split(' ')[0] }}.yml"
  11. - "{{ (ansible_distribution|lower).split(' ')[0] }}.yml"
  12. - "{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
  13. - "defaults.yml"
  14. - name: "INCLUDE: Create monitoring user"
  15. import_tasks: user.yml
  16. - name: "INCLUDE: Install always necessary packages"
  17. include_tasks: packages.yml
  18. when: monitored_packages_install != False
  19. - name: "INCLUDE: Monitoring by NRPE"
  20. include_tasks: nrpe.yml
  21. when: monitored_by_nrpe == True
  22. - name: "INCLUDE: Monitoring by SSH"
  23. include_tasks: ssh.yml
  24. when: monitored_by_ssh == True