1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/munin/tasks/main.yml

99 lines
2.8 KiB
YAML
Raw Normal View History

2019-02-27 02:32:02 +00:00
- name: 'Install 5 packages: munin, munin-node, munin-plugins-extra, libcgi-fast-perl, libapache2-mod-fcgid (debuntu)'
2017-12-08 10:21:07 +00:00
package:
2018-10-28 18:24:53 +00:00
name:
- munin
- munin-node
- munin-plugins-extra
- libcgi-fast-perl
- libapache2-mod-fcgid
2017-12-08 10:21:07 +00:00
state: present
2017-05-27 18:09:50 +00:00
tags:
- download
when: is_debuntu | bool
2017-05-27 18:09:50 +00:00
2019-02-27 02:32:02 +00:00
- name: "Install 2 packages: munin, munin-node (OS's other than debuntu)"
2017-12-08 10:21:07 +00:00
package:
2018-10-28 18:24:53 +00:00
name:
- munin
- munin-node
2017-12-08 10:21:07 +00:00
state: present
2017-05-27 18:09:50 +00:00
tags:
- download
2017-05-27 23:10:45 +00:00
when: not is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-28 18:24:53 +00:00
- name: Install /etc/munin/munin.conf and Apache's munin24.conf, from templates
2017-12-08 10:21:07 +00:00
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
2017-05-27 18:09:50 +00:00
with_items:
- { src: 'munin.conf.j2', dest: '/etc/munin/munin.conf' }
- { src: 'munin24.conf.j2', dest: '/etc/{{ apache_config_dir }}/munin24.conf' }
2018-10-28 18:24:53 +00:00
- name: Establish username/password Admin/changeme in /etc/munin/munin-htpasswd
2017-12-08 10:21:07 +00:00
htpasswd:
path: /etc/munin/munin-htpasswd
name: Admin
password: changeme
create: yes
state: present
2017-05-27 18:09:50 +00:00
2018-10-31 06:26:02 +00:00
- name: Enable & Start munin-node systemd service
2017-12-08 10:21:07 +00:00
service:
name: munin-node
enabled: yes
state: started
when: munin_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-28 18:24:53 +00:00
- name: Create symlink munin24.conf from sites-enabled to sites-available (debuntu)
2017-12-08 10:21:07 +00:00
file:
src: /etc/apache2/sites-available/munin24.conf
2018-10-28 18:24:53 +00:00
path: /etc/apache2/sites-enabled/munin24.conf
2017-12-08 10:21:07 +00:00
state: link
2017-05-27 23:10:45 +00:00
when: munin_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-31 06:26:02 +00:00
- name: Remove symlink /etc/apache2/sites-enabled/munin24.conf if not munin_enabled (debuntu)
2017-12-08 10:21:07 +00:00
file:
2018-10-28 18:24:53 +00:00
path: /etc/apache2/sites-enabled/munin24.conf
2017-12-08 10:21:07 +00:00
state: absent
2017-05-27 23:10:45 +00:00
when: not munin_enabled and is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-28 18:24:53 +00:00
- name: Disable munin-node service if not munin_enabled
2017-12-08 10:21:07 +00:00
service:
name: munin-node
enabled: no
state: stopped
2017-05-27 18:09:50 +00:00
when: not munin_enabled
2017-10-27 14:27:17 +00:00
- name: If MySQL is enabled, let Munin monitor it
2017-12-08 10:21:07 +00:00
copy:
src: "{{ item }}"
dest: /etc/munin/plugins/
2017-05-27 18:09:50 +00:00
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
2017-05-27 18:09:50 +00:00
2018-10-31 06:26:02 +00:00
- name: Add 'munin' variable values to {{ iiab_ini_file }}
2017-12-08 10:21:07 +00:00
ini_file:
2018-10-31 06:26:02 +00:00
path: "{{ iiab_ini_file }}"
2017-12-08 10:21:07 +00:00
section: munin
option: "{{ item.option }}"
value: "{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items:
- option: name
2017-12-08 10:21:07 +00:00
value: Munin
2017-05-27 18:09:50 +00:00
- option: description
value: '"Munin is a networked resource monitoring tool that can help analyze resource trends and \"what just happened to kill our performance?\" problems."'
- option: installed
value: "{{ munin_install }}"
- option: enabled
value: "{{ munin_enabled }}"