2024-08-12 12:46:22 +02:00
|
|
|
---
|
|
|
|
- name: ensure packages are installed
|
|
|
|
become: true
|
|
|
|
ansible.builtin.package:
|
|
|
|
name: "{{ munin_packages }}"
|
|
|
|
state: present
|
|
|
|
|
2024-08-12 13:01:35 +02:00
|
|
|
- name: Ensure needed dirs exists
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
owner: munin
|
|
|
|
group: munin
|
|
|
|
loop: "{{ munin_dirs }}"
|
|
|
|
|
2024-08-12 14:04:58 +02:00
|
|
|
- name: Ensure permissions are set
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /var/lib/munin/cgi-tmp
|
|
|
|
mode: 'ugo+rw'
|
2024-08-12 14:23:14 +02:00
|
|
|
state: directory
|
2024-08-12 15:24:20 +02:00
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-12 14:04:58 +02:00
|
|
|
recurse: true
|
|
|
|
|
2024-08-12 12:53:37 +02:00
|
|
|
- name: Template apache config
|
|
|
|
ansible.builtin.template:
|
2024-08-12 13:17:52 +02:00
|
|
|
src: apache.conf
|
2024-08-12 12:47:43 +02:00
|
|
|
dest: /etc/apache2/sites-available/000-default.conf
|
2024-08-12 13:56:10 +02:00
|
|
|
notify: "restart apache2"
|
2024-08-12 14:02:02 +02:00
|
|
|
|
2024-08-12 12:59:52 +02:00
|
|
|
- name: Enable fgcid
|
2024-08-12 13:31:32 +02:00
|
|
|
community.general.apache2_module:
|
|
|
|
state: present
|
|
|
|
name: fcgid
|
|
|
|
|
2024-08-12 12:59:52 +02:00
|
|
|
- name: Template munin-server plugins
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "/etc/munin/plugins/{{ item }}"
|
|
|
|
mode: '0755'
|
|
|
|
loop: "{{ munin_server_plugins }}"
|
2024-08-12 12:46:22 +02:00
|
|
|
|
2024-08-12 13:06:55 +02:00
|
|
|
- name: Template munin config
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: munin.conf
|
|
|
|
dest: /etc/munin/munin.conf
|
|
|
|
mode: '0644'
|
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-12 14:24:16 +02:00
|
|
|
notify: "restart munin"
|
2024-08-12 12:46:22 +02:00
|
|
|
|
2024-08-12 13:10:59 +02:00
|
|
|
- name: Enable or disable the munin cron job.
|
2024-08-12 15:24:20 +02:00
|
|
|
ansible.builtin.lineinfile:
|
2024-08-12 13:10:59 +02:00
|
|
|
dest: /etc/cron.d/munin
|
|
|
|
state: "{{ munin_cron_job }}"
|
|
|
|
regexp: "^\\*/5 \\* \\* \\* \\*"
|
|
|
|
line: "*/5 * * * * munin if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi"
|
|
|
|
create: true
|
2024-08-12 15:24:20 +02:00
|
|
|
mode: '0644'
|
2024-08-12 13:10:59 +02:00
|
|
|
|
2024-08-12 13:13:37 +02:00
|
|
|
- name: check if munin has been run
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /var/cache/munin/www/index.html
|
|
|
|
register: placeholder
|
2024-08-12 13:10:59 +02:00
|
|
|
|
2024-08-12 13:13:37 +02:00
|
|
|
- name: Template website placeholder
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: placeholder.html
|
|
|
|
dest: /var/cache/munin/www/index.html
|
|
|
|
mode: '0644'
|
|
|
|
owner: munin
|
|
|
|
group: munin
|
|
|
|
when: not placeholder.stat.exists
|
2024-08-12 16:25:14 +02:00
|
|
|
|
|
|
|
- name: Include alerting tasks
|
|
|
|
ansible.builtin.include_tasks: mail.yml
|
2024-08-12 15:35:54 +02:00
|
|
|
...
|