main.yml 728 B

123456789101112131415161718
  1. ---
  2. - name: Install monit
  3. apt: name=monit state=latest
  4. - name: Enable monit HTTP interface
  5. blockinfile:
  6. dest: /etc/monit/monitrc
  7. marker: '# {mark} ANSIBLE MANAGED BLOCK'
  8. block: |
  9. set httpd port 2812 and
  10. use address localhost # only accept connection from localhost
  11. allow localhost # allow localhost to connect to the server and
  12. allow admin:monit # require user 'admin' with password 'monit'
  13. - name: Copy Sidekiq monit config
  14. template: src=monit_sidekiq_config dest=/etc/monit/conf.d/sidekiq_{{ deploy_app_name }}.conf owner={{ deploy_user }} group={{ deploy_user }}
  15. notify: restart monit
  16. when: monit_sidekiq_enabled is defined and monit_sidekiq_enabled == true