mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
- name: Record (initial) disk space used
|
|
shell: df -B1 --output=used / | tail -1
|
|
register: df1
|
|
|
|
|
|
# SEE ALSO roles/network/tasks/install.yml
|
|
- name: "TEMPORARILY REVERT net.ipv6.conf.all.disable_ipv6 to 0 in /etc/sysctl.conf for #3434"
|
|
sysctl:
|
|
name: net.ipv6.conf.all.disable_ipv6
|
|
value: 0
|
|
|
|
- name: "Install 5 packages: libcgi-fast-perl, munin, munin-node, munin-plugins-extra, python3-passlib"
|
|
package:
|
|
name:
|
|
#- libapache2-mod-fcgid
|
|
- libcgi-fast-perl
|
|
- munin
|
|
- munin-node
|
|
- munin-plugins-extra
|
|
- python3-passlib # For Ansible module 'htpasswd' in Ansible collection community.general -- used just below
|
|
state: present
|
|
|
|
# SEE ALSO roles/network/tasks/install.yml
|
|
- name: RESTORE net.ipv6.conf.all.disable_ipv6 to 1 in /etc/sysctl.conf for #3434
|
|
sysctl:
|
|
name: net.ipv6.conf.all.disable_ipv6
|
|
value: 1
|
|
|
|
- name: Establish username/password Admin/changeme in /etc/munin/munin-htpasswd
|
|
htpasswd:
|
|
path: /etc/munin/munin-htpasswd
|
|
name: "{{ munin_username}}" # Admin
|
|
password: "{{ munin_password }}" # changeme
|
|
|
|
- name: If MySQL is installed, let Munin monitor it
|
|
copy:
|
|
src: "{{ item }}"
|
|
dest: /etc/munin/plugins/
|
|
with_items:
|
|
- /usr/share/munin/plugins/mysql_
|
|
- /usr/share/munin/plugins/mysql_bytes
|
|
- /usr/share/munin/plugins/mysql_innodb
|
|
- /usr/share/munin/plugins/mysql_isam_space_
|
|
- /usr/share/munin/plugins/mysql_queries
|
|
- /usr/share/munin/plugins/mysql_slowqueries
|
|
- /usr/share/munin/plugins/mysql_threads
|
|
when: mysql_installed
|
|
#when: mysql_enabled
|
|
|
|
|
|
# RECORD Munin AS INSTALLED
|
|
|
|
- name: Record (final) disk space used
|
|
shell: df -B1 --output=used / | tail -1
|
|
register: df2
|
|
|
|
- name: Add 'munin_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
|
|
section: munin
|
|
option: munin_disk_usage
|
|
value: "{{ df2.stdout|int - df1.stdout|int }}"
|
|
|
|
- name: "Set 'munin_installed: True'"
|
|
set_fact:
|
|
munin_installed: True
|
|
|
|
- name: "Add 'munin_installed: True' to {{ iiab_state_file }}"
|
|
lineinfile:
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
|
regexp: '^munin_installed'
|
|
line: 'munin_installed: True'
|