mon.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. - name: Install mon packages
  2. action: ${ansible_pkg_mgr} pkg=mon state=installed update_cache=yes
  3. when_boolean: ${with_mon}
  4. - name: Create need directory for mon configuration
  5. action: file path=/etc/mon/mon.d state=directory owner=root group=root mode=0755
  6. when_boolean: ${with_mon}
  7. - name: Install mon configuration
  8. action: template src=mon/${ansible_hostname}.conf.j2 dest=/etc/mon/mon.cf owner=root group=root mode=0644
  9. notify:
  10. - Restart mon
  11. when_boolean: ${with_mon}
  12. - name: Install mon (default) configuration
  13. action: template src=mon/default.j2 dest=/etc/default/mon owner=root group=root mode=0644
  14. notify:
  15. - Restart mon
  16. when_boolean: ${with_mon}
  17. - name: Install custom mon plugins
  18. action: copy src=mon/${item}.monitor dest=/etc/mon/mon.d/${item}.monitor owner=root group=root mode=0755
  19. with_items:
  20. - https
  21. - imaps
  22. - dns
  23. notify:
  24. - Restart mon
  25. when_boolean: ${with_mon}
  26. - name: Install mon plugins
  27. action: file src=/usr/lib/mon/mon.d/${item}.monitor path=/etc/mon/mon.d/${item}.monitor state=link
  28. with_items:
  29. - fping
  30. - http
  31. - smtp
  32. - imap
  33. - tcp
  34. notify:
  35. - Restart mon
  36. when_boolean: ${with_mon}
  37. - name: Ensure mon is running
  38. action: service name=mon state=started
  39. when_boolean: ${with_mon}