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

61 lines
1.3 KiB
YAML
Raw Normal View History

2017-10-28 00:56:48 +00:00
- name: Install Monit package
2017-12-08 10:15:38 +00:00
package:
name: monit
state: present
2017-05-27 18:09:50 +00:00
tags:
- download
2017-10-28 00:56:48 +00:00
- name: Install chkconfig package -- not in Debian 8
2017-12-08 10:15:38 +00:00
package:
name: chkconfig
state: present
when: is_debian and ansible_distribution_major_version == "8"
2017-05-27 18:09:50 +00:00
tags:
- download
- name: Update main config file
2017-12-08 10:15:38 +00:00
template:
backup: yes
src: monitrc
dest: /etc/monitrc
owner: root
group: root
mode: 0600
2017-05-27 18:09:50 +00:00
- name: Update config files
2017-12-08 10:15:38 +00:00
template:
src: "{{ item }}"
dest: "/etc/monit.d/{{ item }}"
owner: root
group: root
force: yes
mode: 0755
2017-05-27 18:09:50 +00:00
with_items: watchdog
register: monit_config
when: false
until: monit_config | success
2017-05-27 18:09:50 +00:00
retries: 5
delay: 1
#TODO: create systemd script
2017-10-28 00:56:48 +00:00
- name: Enable 'monit' service
2017-05-27 18:09:50 +00:00
command: chkconfig monit on
when: is_debian and ansible_local.local_facts.os_ver == "debian-8"
2017-05-27 18:09:50 +00:00
#- name: Restart monit service
# command: service monit restart
2017-12-08 10:15:38 +00:00
- name: Add 'monit' to list of services at /etc/iiab/iiab.ini
ini_file:
dest: "{{ service_filelist }}"
section: monit
option: "{{ item.option }}"
value: "{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items:
- option: name
2017-12-08 10:15:38 +00:00
value: Monit
2017-05-27 18:09:50 +00:00
- option: description
2017-10-28 00:56:48 +00:00
value: '"Monit is a background service monitor which can correct problems, send email, restart services."'
2017-05-27 18:09:50 +00:00
- option: enabled
value: "{{ monit_enabled }}"