2014-05-11 18:10:54 +00:00
|
|
|
---
|
2014-05-12 03:32:24 +00:00
|
|
|
- name: Include OS-specific variables.
|
|
|
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
2014-05-11 18:10:54 +00:00
|
|
|
|
2014-05-12 03:32:24 +00:00
|
|
|
- name: Install required packages for munin (RedHat).
|
2015-10-05 11:30:56 +00:00
|
|
|
yum: "name={{ item }} state=present"
|
2016-03-11 16:27:47 +00:00
|
|
|
with_items: "{{ munin_packages }}"
|
2014-05-12 03:32:24 +00:00
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
|
|
- name: Install required packages for munin (Debian).
|
2015-10-05 11:30:56 +00:00
|
|
|
apt: "name={{ item }} state=present"
|
2016-03-11 16:27:47 +00:00
|
|
|
with_items: "{{ munin_packages }}"
|
2014-05-12 03:32:24 +00:00
|
|
|
when: ansible_os_family == 'Debian'
|
2014-05-11 18:10:54 +00:00
|
|
|
|
|
|
|
|
- name: Copy munin configurations.
|
2015-10-05 11:30:56 +00:00
|
|
|
template:
|
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0644
|
2014-05-11 18:10:54 +00:00
|
|
|
with_items:
|
2015-10-05 11:30:56 +00:00
|
|
|
- src: munin.conf.j2
|
|
|
|
|
dest: /etc/munin/munin.conf
|
|
|
|
|
- src: hosts.conf.j2
|
|
|
|
|
dest: "{{ munin_conf_d_directory }}/hosts.conf"
|
2014-05-11 18:10:54 +00:00
|
|
|
|
|
|
|
|
- name: Create munin user via htpasswd.
|
2015-10-05 11:30:56 +00:00
|
|
|
htpasswd:
|
2018-09-29 00:19:24 +00:00
|
|
|
create: true
|
2015-10-05 11:30:56 +00:00
|
|
|
name: "{{ munin_admin_user }}"
|
|
|
|
|
password: "{{ munin_admin_password }}"
|
|
|
|
|
path: /etc/munin/munin-htpasswd
|
|
|
|
|
state: present
|
2015-03-02 16:48:01 +00:00
|
|
|
|
|
|
|
|
- name: Enable or disable the munin cron job.
|
|
|
|
|
lineinfile:
|
|
|
|
|
dest: /etc/cron.d/munin
|
|
|
|
|
state: "{{ munin_cron_job }}"
|
|
|
|
|
regexp: "^\\*/5 \\* \\* \\* \\*"
|
|
|
|
|
line: "*/5 * * * * munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron"
|