homeserver/roles/mgrote_munin_server/tasks/main.yml
Michael Grote d71645de30
Some checks failed
ci/woodpecker/push/gitleaks Pipeline failed
ci/woodpecker/pr/gitleaks Pipeline failed
ci/woodpecker/push/ansible-lint unknown status
ci/woodpecker/pr/ansible-lint unknown status
f
2024-08-21 20:31:27 +02:00

105 lines
2.4 KiB
YAML

---
- name: ensure packages are installed
become: true
ansible.builtin.package:
name: "{{ munin_packages }}"
state: present
- name: Ensure needed dirs exists
ansible.builtin.file:
path: "{{ item.name }}"
state: directory
mode: "{{ item.mode }}"
owner: "{{ item.owner }}"
group: "{{ item.group }}"
loop:
- name: /var/run/munin
mode: '0755'
owner: munin
group: munin
- name: /var/lib/munin-node/plugin-state
mode: '0775'
owner: munin
group: munin
- name: /etc/munin/plugins
mode: '0755'
owner: munin
group: munin
- name: /var/cache/munin/www
mode: '0755'
owner: munin
group: root
- name: /var/lib/munin
mode: '0755'
owner: munin
group: munin
- name: /var/cache/munin
mode: '0755'
owner: root
group: root
- name: /var/lib/munin/cgi-tmp
mode: '0777'
owner: munin
group: www-data
- 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"
- name: "apache2: enable rewrite"
community.general.apache2_module:
state: present
name: rewrite
notify: "restart apache2"
- name: "apache2: enable rewrite"
community.general.apache2_module:
state: present
name: fcgid
notify: "restart apache2"
- 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'
notify: "restart munin"
- 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
...