main.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ---
  2. - name: Sanity checks
  3. assert:
  4. that:
  5. - monitored_dont|default(False) != True
  6. - monitored_by_nrpe == True or monitored_by_nrpe_ng == True or monitored_by_ssh == True
  7. - name: Gather OS Specific Variables
  8. include_vars: "{{ item }}"
  9. with_first_found:
  10. - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_version|lower).split(' ')[0] }}.yml"
  11. - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_major_version|lower).split(' ')[0] }}.yml"
  12. - "{{ (ansible_distribution|lower).split(' ')[0] }}.yml"
  13. - "{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
  14. - name: "Install dependencies"
  15. package:
  16. name: "{{ monitored_packages_predepends }}"
  17. state: latest
  18. when: monitored_packages_predepends|default(False)
  19. - name: "INCLUDE: Create monitoring user"
  20. import_tasks: user.yml
  21. - name: "INCLUDE: Install always necessary packages"
  22. include_tasks: packages.yml
  23. when: monitored_packages_install != False
  24. - name: "INCLUDE: Copy custom plugins"
  25. include_tasks: plugins_custom.yml
  26. when: monitored_plugins_custom|default([]) != []
  27. - name: "INCLUDE: Monitoring by NRPE"
  28. include_tasks: nrpe.yml
  29. when: monitored_by_nrpe == True
  30. - name: "INCLUDE: Monitoring by SSH"
  31. include_tasks: ssh.yml
  32. when: monitored_by_ssh == True