ansible-role-munin/tasks/main.yml

42 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Install required packages for munin (RedHat).
yum: "name={{ item }} state=present"
2016-03-11 16:27:47 +00:00
with_items: "{{ munin_packages }}"
when: ansible_os_family == 'RedHat'
- name: Install required packages for munin (Debian).
apt: "name={{ item }} state=present"
2016-03-11 16:27:47 +00:00
with_items: "{{ munin_packages }}"
when: ansible_os_family == 'Debian'
- name: Copy munin configurations.
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
with_items:
- src: munin.conf.j2
dest: /etc/munin/munin.conf
- src: hosts.conf.j2
dest: "{{ munin_conf_d_directory }}/hosts.conf"
- name: Create munin user via htpasswd.
htpasswd:
create: yes
name: "{{ munin_admin_user }}"
password: "{{ munin_admin_password }}"
path: /etc/munin/munin-htpasswd
state: present
- 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"