1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Overhaul munin/tasks/enable.yml

This commit is contained in:
A Holt 2020-01-13 19:21:44 -05:00 committed by GitHub
parent ce2ef7dbd4
commit 7f2d43c493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,54 +1,54 @@
- name: If MySQL is enabled, let Munin monitor it - name: Enable & Start 'munin-node' systemd service
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_enabled | bool
- name: Enable & Start munin-node systemd service
systemd: systemd:
name: munin-node name: munin-node
daemon_reload: yes
enabled: yes enabled: yes
state: started state: started
when: munin_enabled | bool when: munin_enabled | bool
- name: Disable munin-node service if not munin_enabled - name: Disable 'munin-node' systemd service
systemd: systemd:
name: munin-node name: munin-node
enabled: no enabled: no
state: stopped state: stopped
when: not munin_enabled when: not munin_enabled
- name: Create symlink munin24.conf from sites-enabled to sites-available (debuntu) # Apache
file:
src: /etc/apache2/sites-available/munin24.conf
path: /etc/apache2/sites-enabled/munin24.conf
state: link
when: munin_enabled and not nginx_enabled
- name: Remove symlink /etc/apache2/sites-enabled/munin24.conf if not munin_enabled (debuntu) - name: Enable http://box/munin via Apache
file: command: a2ensite munin24.conf
path: /etc/apache2/sites-enabled/munin24.conf when: apache_install and munin_enabled # and not nginx_enabled
state: absent
when: not munin_enabled or nginx_enabled
- name: Install /etc/nginx/conf.d/munin24-nginx.conf, from templates - name: Disable http://box/munin via Apache
command: a2dissite munin24.conf
when: apache_install and not munin_enabled # or nginx_enabled
- name: Restart Apache systemd service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted
when: apache_enabled | bool
# NGINX
- name: Enable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf from template
template: template:
src: "{{ item.src }}" src: munin24-nginx.conf.j2
dest: "{{ item.dest }}" dest: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
owner: root when: munin_enabled and nginx_enabled
group: root
mode: 0644 - name: Disable http://box/munin via NGINX, by installing {{ nginx_config_dir }}/munin24-nginx.conf
with_items: file:
- { src: 'munin24-nginx.conf.j2', dest: '/etc/nginx/conf.d/munin24-nginx.conf' } path: "{{ nginx_config_dir }}/munin24-nginx.conf" # /etc/nginx/conf.d
when: munin_enabled | bool and nginx_enabled | bool state: absent
when: not munin_enabled
- name: Restart 'nginx' systemd service
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
- name: Add 'munin' variable values to {{ iiab_ini_file }} - name: Add 'munin' variable values to {{ iiab_ini_file }}
ini_file: ini_file: