2024-08-12 23:46:08 +02:00
|
|
|
---
|
|
|
|
- name: ensure packages are installed
|
|
|
|
become: true
|
|
|
|
ansible.builtin.package:
|
|
|
|
name: "{{ munin_packages }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Ensure needed dirs exists
|
|
|
|
ansible.builtin.file:
|
2024-08-21 18:03:34 +02:00
|
|
|
path: "{{ item.name }}"
|
2024-08-12 23:46:08 +02:00
|
|
|
state: directory
|
2024-08-21 18:03:34 +02:00
|
|
|
mode: "{{ item.mode }}"
|
|
|
|
owner: "{{ item.owner }}"
|
|
|
|
group: "{{ item.group }}"
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: "{{ item.recurse }}"
|
2024-08-21 18:01:49 +02:00
|
|
|
loop:
|
|
|
|
- name: /var/run/munin
|
|
|
|
mode: '0755'
|
2024-08-21 18:03:34 +02:00
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 20:03:43 +02:00
|
|
|
- name: /var/lib/munin-node/plugin-state
|
|
|
|
mode: '0775'
|
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 18:01:49 +02:00
|
|
|
- name: /etc/munin/plugins
|
|
|
|
mode: '0755'
|
2024-08-21 18:03:34 +02:00
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 18:01:49 +02:00
|
|
|
- name: /var/cache/munin/www
|
|
|
|
mode: '0755'
|
2024-08-21 20:03:43 +02:00
|
|
|
owner: munin
|
2024-08-21 18:14:51 +02:00
|
|
|
group: root
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 18:01:49 +02:00
|
|
|
- name: /var/lib/munin
|
|
|
|
mode: '0755'
|
2024-08-21 18:03:34 +02:00
|
|
|
owner: munin
|
|
|
|
group: munin
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 18:01:49 +02:00
|
|
|
- name: /var/cache/munin
|
|
|
|
mode: '0755'
|
2024-08-21 18:04:05 +02:00
|
|
|
owner: root
|
|
|
|
group: root
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: false
|
2024-08-21 20:43:49 +02:00
|
|
|
- name: /var/lib/munin/cgi-tmp # TODO hier wird immer changed angezeigt, vmtl 777 --> 644
|
2024-08-21 20:46:30 +02:00
|
|
|
mode: '774'
|
2024-08-21 20:35:45 +02:00
|
|
|
owner: www-data
|
2024-08-21 20:44:44 +02:00
|
|
|
group: munin
|
2024-08-21 20:33:50 +02:00
|
|
|
recurse: true
|
2024-08-12 23:46:08 +02:00
|
|
|
|
|
|
|
- name: Template apache config
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: apache.conf
|
|
|
|
dest: /etc/apache2/sites-available/000-default.conf
|
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
notify: "restart apache2"
|
|
|
|
|
2024-08-21 20:28:17 +02:00
|
|
|
- name: "apache2: enable rewrite"
|
|
|
|
community.general.apache2_module:
|
|
|
|
state: present
|
|
|
|
name: rewrite
|
|
|
|
notify: "restart apache2"
|
|
|
|
|
|
|
|
- name: "apache2: enable rewrite"
|
2024-08-12 23:46:08 +02:00
|
|
|
community.general.apache2_module:
|
|
|
|
state: present
|
2024-08-21 20:05:54 +02:00
|
|
|
name: fcgid
|
2024-08-21 18:35:02 +02:00
|
|
|
notify: "restart apache2"
|
2024-08-12 23:46:08 +02:00
|
|
|
|
|
|
|
- name: Template munin-server plugins
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "/etc/munin/plugins/{{ item }}"
|
|
|
|
mode: '0755'
|
|
|
|
loop: "{{ munin_server_plugins }}"
|
|
|
|
|
|
|
|
- name: Template munin config
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: munin.conf
|
|
|
|
dest: /etc/munin/munin.conf
|
|
|
|
mode: '0644'
|
|
|
|
owner: munin
|
|
|
|
group: munin
|
|
|
|
notify: "restart munin"
|
|
|
|
|
|
|
|
- name: Enable or disable the munin cron job.
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
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
|
|
|
|
mode: '0644'
|
2024-08-21 18:35:02 +02:00
|
|
|
notify: "restart munin"
|
2024-08-12 23:46:08 +02:00
|
|
|
|
|
|
|
- name: check if munin has been run
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /var/cache/munin/www/index.html
|
|
|
|
register: placeholder
|
|
|
|
|
|
|
|
- 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
|
|
|
|
...
|