1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/monit/tasks/install.yml

62 lines
1.5 KiB
YAML

- name: Record (initial) disk space used
shell: df -B1 --output=used / | tail -1
register: df1
- name: Install 'monit' package
package:
name: monit
state: present
# - name: Install chkconfig package (debian-8)
# package:
# name: chkconfig
# state: present
# when: is_debian and ansible_distribution_major_version == "8"
#- 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 (NEVER RUNS, WHY?)
# template:
# src: watchdog
# dest: /etc/monit.d/watchdog
# owner: root
# group: root
# force: yes
# mode: '0755'
# register: monit_config
# when: False # IS THIS A BUG ?
# until: monit_config | success
# retries: 5
# delay: 1
# RECORD Monit AS INSTALLED
- name: Record (final) disk space used
shell: df -B1 --output=used / | tail -1
register: df2
- name: Add 'monit_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: monit
option: monit_disk_usage
value: "{{ df2.stdout|int - df1.stdout|int }}"
- name: "Set 'monit_installed: True'"
set_fact:
monit_installed: True
- name: "Add 'monit_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^monit_installed'
line: 'monit_installed: True'