ansible-base/roles/munin-node/tasks/main.yml

66 lines
1.7 KiB
YAML
Raw Normal View History

---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Ensure munin-node is installed (RedHat).
yum: name=munin-node state=present enablerepo=epel
when: ansible_os_family == 'RedHat'
- name: Ensure munin-node is installed (Debian).
apt: name=munin-node state=present
when: ansible_os_family == 'Debian'
- name: Munin (node) USE flag configuration (Gentoo).
copy:
src: package.use.munin
dest: /etc/portage/package.use/munin
owner: root
group: root
mode: 0644
when: ansible_os_family == 'Gentoo'
- name: Ensure munin (node) is installed (Gentoo).
portage:
name: munin
newuse: yes
changed_use: yes
state: latest
when: ansible_os_family == 'Gentoo'
notify: restart munin-node
2020-08-23 17:55:09 +02:00
- name: Ensure munin (node) is installed (OpenBSD).
openbsd_pkg:
name: munin-node
state: latest
when: ansible_os_family == 'OpenBSD'
notify: restart munin-node
- name: Copy munin-node configuration.
template:
src: munin-node.conf.j2
dest: /etc/munin/munin-node.conf
2020-08-23 17:55:09 +02:00
owner: "{{ munin_node_user }}"
group: "{{ munin_node_group }}"
mode: 0644
notify: restart munin-node
- name: Generate plugin configuration.
template:
src: plugin-conf.j2
dest: /etc/munin/plugin-conf.d/ansible.conf
2020-08-23 17:55:09 +02:00
owner: "{{ munin_node_user }}"
group: "{{ munin_node_group }}"
mode: 0644
notify: restart munin-node
- name: Enable additional plugins.
file:
path: "{{ munin_plugin_dest_path }}{{ item.name }}"
src: "{{ munin_plugin_src_path }}{{ item.plugin | default( item.name ) }}"
state: link
with_items: "{{ munin_node_plugins }}"
notify: restart munin-node
- name: Ensure munin-node is running.
2020-08-23 17:55:09 +02:00
service: name="{{ munin_node_service }}" state=started enabled=yes