mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
60 lines
1.3 KiB
YAML
60 lines
1.3 KiB
YAML
- name: Install Monit package
|
|
package:
|
|
name: monit
|
|
state: present
|
|
tags:
|
|
- download
|
|
|
|
- name: Install chkconfig package -- not in Debian 8
|
|
package:
|
|
name: chkconfig
|
|
state: present
|
|
when: is_debian and ansible_distribution_major_version == "8"
|
|
tags:
|
|
- download
|
|
|
|
- name: Update main config file
|
|
template:
|
|
backup: yes
|
|
src: monitrc
|
|
dest: /etc/monitrc
|
|
owner: root
|
|
group: root
|
|
mode: 0600
|
|
|
|
- name: Update config files
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "/etc/monit.d/{{ item }}"
|
|
owner: root
|
|
group: root
|
|
force: yes
|
|
mode: 0755
|
|
with_items: watchdog
|
|
register: monit_config
|
|
when: false
|
|
until: monit_config | success
|
|
retries: 5
|
|
delay: 1
|
|
|
|
#TODO: create systemd script
|
|
- name: Enable 'monit' service
|
|
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' to list of services at /etc/iiab/iiab.ini
|
|
ini_file:
|
|
dest: "{{ service_filelist }}"
|
|
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 }}"
|