ansible-roles/postgresql/tasks/munin.yml
Jérémy Lecour ee21973371
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2777|524|2253|2462|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
Use FQCN
Fully Qualified Collection Name
2023-03-20 23:33:19 +01:00

45 lines
1.3 KiB
YAML

---
- name: Are Munin plugins present in /etc ?
ansible.builtin.stat:
path: /etc/munin/plugins
register: etc_munin_plugins
- name: Are Munin plugins present in /usr/share ?
ansible.builtin.stat:
path: /usr/share/munin/plugins
register: usr_share_munin_plugins
- name: Add Munin plugins for PostgreSQL
ansible.builtin.file:
state: link
src: '/usr/share/munin/plugins/{{ item }}'
dest: '/etc/munin/plugins/{{ item }}'
loop:
- postgres_bgwriter
- postgres_checkpoints
- postgres_connections_db
- postgres_users
- postgres_xlog
notify: restart munin-node
when: etc_munin_plugins.stat.exists and usr_share_munin_plugins.stat.exists
- name: Add Munin plugins for PostgreSQL (for specific databases)
ansible.builtin.file:
state: link
src: '/usr/share/munin/plugins/{{ item[0] }}'
dest: '/etc/munin/plugins/{{ item[0] }}{{ item[1] }}'
loop: "{{ _plugins | product(_databases) | list }}"
vars:
_plugins:
- 'postgres_cache_'
- 'postgres_connections_'
- 'postgres_locks_'
- 'postgres_querylength_'
- 'postgres_scans_'
- 'postgres_size_'
- 'postgres_transactions_'
- 'postgres_tuples_'
_databases: "{{ postgresql_databases }}"
notify: restart munin-node
when: etc_munin_plugins.stat.exists and usr_share_munin_plugins.stat.exists