87 lines
2 KiB
YAML
87 lines
2 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 }}"
|
||
|
state: directory
|
||
|
mode: '0755'
|
||
|
owner: munin
|
||
|
group: munin
|
||
|
loop: "{{ munin_dirs }}"
|
||
|
|
||
|
- name: Ensure permissions are set
|
||
|
ansible.builtin.file:
|
||
|
path: /var/lib/munin/cgi-tmp
|
||
|
mode: 'ugo+rw'
|
||
|
state: directory
|
||
|
owner: munin
|
||
|
group: munin
|
||
|
recurse: true
|
||
|
|
||
|
- 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: Enable fgcid
|
||
|
community.general.apache2_module:
|
||
|
state: present
|
||
|
name: fcgid
|
||
|
|
||
|
- 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'
|
||
|
|
||
|
- 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
|
||
|
|
||
|
- name: Template ssmtp config
|
||
|
ansible.builtin.template:
|
||
|
src: ssmtp.conf
|
||
|
dest: /etc/ssmtp/ssmtp.conf
|
||
|
mode: '0644'
|
||
|
owner: root
|
||
|
group: root
|
||
|
...
|