mon.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. - name: Install mon packages
  2. apt: pkg=mon state=installed update_cache=yes
  3. when: with_mon
  4. - name: Create need directory for mon configuration
  5. file: path=/etc/mon/mon.d state=directory owner=root group=root mode=0755
  6. when: with_mon
  7. - name: Install mon configuration
  8. 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: with_mon
  12. - name: Install mon (default) configuration
  13. template: src=mon/default.j2 dest=/etc/default/mon owner=root group=root mode=0644
  14. notify:
  15. - Restart mon
  16. when: with_mon
  17. - name: Install custom mon plugins
  18. 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: with_mon
  26. - name: Install mon plugins
  27. 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: with_mon
  37. - name: Ensure mon is running
  38. service: name=mon state=started
  39. when: with_mon