main.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. - name: "Install dependencies"
  14. package:
  15. name: "{{ monitored_packages_predepends }}"
  16. state: latest
  17. when: monitored_packages_predepends
  18. - name: "INCLUDE: Create monitoring user"
  19. import_tasks: user.yml
  20. - name: "INCLUDE: Install always necessary packages"
  21. include_tasks: packages.yml
  22. when: monitored_packages_install != False
  23. - name: "INCLUDE: Copy custom plugins"
  24. include_tasks: plugins_custom.yml
  25. when: monitored_plugins_custom|default([]) != []
  26. - name: "INCLUDE: Monitoring by NRPE"
  27. include_tasks: nrpe.yml
  28. when: monitored_by_nrpe == True
  29. - name: "INCLUDE: Monitoring by SSH"
  30. include_tasks: ssh.yml
  31. when: monitored_by_ssh == True