1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/monit/tasks/main.yml
2018-10-31 02:36:30 -04:00

59 lines
1.4 KiB
YAML

- name: Install Monit package
package:
name: monit
state: present
tags:
- download
- name: Install chkconfig package (debian-8)
package:
name: chkconfig
state: present
when: is_debian and ansible_distribution_major_version == "8"
tags:
- download
- name: Install /etc/monitrc from template
template:
backup: yes
src: monitrc
dest: /etc/monitrc
owner: root
group: root
mode: 0600
- name: Install config file /etc/monit.d/watchdog from template
template:
src: watchdog
dest: /etc/monit.d/watchdog
owner: root
group: root
force: yes
mode: 0755
register: monit_config
when: false
until: monit_config | success
retries: 5
delay: 1
#TODO: create systemd script
- name: Enable 'monit' service (chkconfig monit on)
command: chkconfig monit on
when: is_debian and ansible_local.local_facts.os_ver == "debian-8"
#- name: Restart monit service
# command: service monit restart
- name: Add 'monit' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: monit
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: Monit
- option: description
value: '"Monit is a background service monitor which can correct problems, send email, restart services."'
- option: enabled
value: "{{ monit_enabled }}"