mon.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. - name: 'Install mon packages'
  2. apt:
  3. pkg: 'mon'
  4. state: 'present'
  5. tags:
  6. - 'monitoring'
  7. - 'mon'
  8. - name: 'Create need directory for mon configuration'
  9. file:
  10. path: '/etc/mon/mon.d'
  11. state: 'directory'
  12. owner: 'root'
  13. group: 'root'
  14. mode: '0755'
  15. tags:
  16. - 'monitoring'
  17. - 'mon'
  18. - name: 'Install mon configuration'
  19. template:
  20. src: 'mon/{{ ansible_hostname }}.conf.j2'
  21. dest: '/etc/mon/mon.cf'
  22. owner: 'root'
  23. group: 'root'
  24. mode: '0644'
  25. notify:
  26. - 'Restart mon'
  27. tags:
  28. - 'monitoring'
  29. - 'mon'
  30. - name: 'Install mon (default) configuration'
  31. template:
  32. src: 'mon/default.j2'
  33. dest: '/etc/default/mon'
  34. owner: 'root'
  35. group: 'root'
  36. mode: '0644'
  37. notify:
  38. - 'Restart mon'
  39. tags:
  40. - 'monitoring'
  41. - 'mon'
  42. - name: 'Install custom mon plugins'
  43. copy:
  44. src: 'mon/{{ item }}.monitor'
  45. dest: '/etc/mon/mon.d/{{ item }}.monitor'
  46. owner: 'root'
  47. group: 'root'
  48. mode: '0755'
  49. with_items:
  50. - 'https'
  51. - 'imaps'
  52. - 'dns'
  53. notify:
  54. - 'Restart mon'
  55. tags:
  56. - 'monitoring'
  57. - 'mon'
  58. - name: 'Install mon plugins'
  59. file:
  60. src: '/usr/lib/mon/mon.d/{{ item }}.monitor'
  61. path: '/etc/mon/mon.d/{{ item }}.monitor'
  62. state: 'link'
  63. with_items:
  64. - 'fping'
  65. - 'http'
  66. - 'smtp'
  67. - 'imap'
  68. - 'tcp'
  69. notify:
  70. - 'Restart mon'
  71. tags:
  72. - 'monitoring'
  73. - 'mon'
  74. - name: 'Ensure mon is running'
  75. service:
  76. name: 'mon'
  77. state: 'started'
  78. tags:
  79. - 'monitoring'
  80. - 'mon'
  81. # vim: ft=yaml.ansible