Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

monit.yml 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. - name: Add monitoring vhost to apache
  2. copy: src=etc_apache2_sites-available_00-status.conf dest=/etc/apache2/sites-available/00-status.conf
  3. - name: Enable the status vhost
  4. command: a2ensite 00-status.conf creates=/etc/apache2/sites-enabled/00-status.conf
  5. notify: restart apache
  6. - name: Install monit
  7. apt:
  8. name: monit
  9. state: present
  10. tags:
  11. - dependencies
  12. - name: Copy monit master config file into place
  13. template: src=etc_monit_monitrc.j2 dest=/etc/monit/monitrc
  14. notify: restart monit
  15. - name: Determine if ZNC is installed
  16. stat: path=/usr/lib/znc/configs/znc.conf
  17. register: znc_config_file
  18. - name: Determine if XMPP is installed
  19. stat: path=/etc/prosody/prosody.cfg.lua
  20. register: prosody_config_file
  21. - name: Determine if Fathom is installed
  22. stat: path=/usr/local/bin/fathom
  23. register: fathom_config_file
  24. - name: Determine if Redis is installed
  25. stat: path=/etc/redis/redis.conf
  26. register: redis_config_file
  27. - name: Determine if RSpamD is installed
  28. stat: path=/etc/rspamd/rspamd.conf
  29. register: rspamd_config_file
  30. - name: Determine if gitea is installed
  31. stat: path=/etc/gitea/app.ini
  32. register: gitea_config_file
  33. - name: Determine if Synapse is installed
  34. stat: path=/etc/matrix-synapse/homeserver.yaml
  35. register: synapse_config_file
  36. - name: Determine if Mastodon is installed
  37. stat: path=/home/mastodon/mastodon
  38. register: mastodon_config_file
  39. - name: Copy ZNC monit service config files into place
  40. copy: src=etc_monit_conf.d_znc dest=/etc/monit/conf.d/znc
  41. notify: restart monit
  42. when: znc_config_file.stat.exists == True
  43. - name: Copy XMPP monit service config files into place
  44. copy: src=etc_monit_conf.d_prosody dest=/etc/monit/conf.d/prosody
  45. notify: restart monit
  46. when: prosody_config_file.stat.exists == True
  47. - name: Copy Fathom monit service config files into place
  48. copy: src=etc_monit_conf.d_fathom dest=/etc/monit/conf.d/fathom
  49. notify: restart monit
  50. when: fathom_config_file.stat.exists == True
  51. - name: Copy Redis monit service config files into place
  52. copy: src=etc_monit_conf.d_redis dest=/etc/monit/conf.d/redis
  53. notify: restart monit
  54. when: redis_config_file.stat.exists == True
  55. - name: Copy RSpamD monit service config files into place
  56. copy: src=etc_monit_conf.d_rspamd dest=/etc/monit/conf.d/rspamd
  57. notify: restart monit
  58. when: rspamd_config_file.stat.exists == True
  59. - name: Copy gitea monit service config files into place
  60. copy: src=etc_monit_conf.d_gitea dest=/etc/monit/conf.d/gitea
  61. notify: restart monit
  62. when: gitea_config_file.stat.exists == True
  63. - name: Copy Synapse monit service config files into place
  64. copy: src=etc_monit_conf.d_matrix dest=/etc/monit/conf.d/matrix
  65. notify: restart monit
  66. when: synapse_config_file.stat.exists == True
  67. - name: Copy Mastodon monit service config files into place
  68. copy: src=etc_monit_conf.d_mastodon dest=/etc/monit/conf.d/mastodon
  69. notify: restart monit
  70. when: mastodon_config_file.stat.exists == True
  71. - name: Copy monit service config files into place
  72. copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
  73. with_items:
  74. - apache2
  75. - dovecot
  76. - pgsql
  77. - postfix
  78. - sshd
  79. - tomcat
  80. notify: restart monit
  81. # TODO add to fail2ban when monit_page_public == 1
  82. - name: Create the Apache monit sites config files
  83. template:
  84. src=etc_apache2_sites-available_monit.j2
  85. dest=/etc/apache2/sites-available/monit_{{ item.name }}.conf
  86. owner=root
  87. group=root
  88. with_items: "{{ virtual_domains }}"
  89. when: monit_page_public == 1
  90. - name: Enable Apache sites (creates new sites-enabled symlinks)
  91. command: a2ensite monit_{{ item }}.conf creates=/etc/apache2/sites-enabled/monit_{{ item }}.conf
  92. notify: restart apache
  93. with_items: "{{ virtual_domains | json_query('[*].name') }}"
  94. when: monit_page_public == 1