talas-group/04_INFRA_DEPLOIEMENT/Ansible/roles/postgres/tasks/zabbix.yml
senke 66471934af Initial commit: Talas Group project management & documentation
Knowledge base of ~80+ markdown files across 14 domains (00-13),
Logseq graph, hardware design files (KiCAD), infrastructure configs,
and talas-wiki static site.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:10:41 +02:00

63 lines
1.6 KiB
YAML

---
# file: roles/postgres/tasks/zabbix.yml
- name: "[zabbix] scripts"
copy:
src: "{{ item }}"
dest: "/etc/zabbix/scripts/{{ item }}"
mode: 0755
loop:
- pg_stat_database.sh
- pg_connection_reaper.sh
- pg_replication_slots_discovery.sh
tags:
- postgres
- zabbix
- name: "[zabbix] /etc/zabbix/zabbix_agentd.conf.d/postgresql.conf (static)"
copy:
src: zabbix_postgresql.conf
dest: /etc/zabbix/zabbix_agentd.conf.d/postgresql.conf
mode: 0644
notify: restart zabbix_agent
tags:
- postgres
- zabbix
- name: "[zabbix] pg < 10 specific"
set_fact:
postgres_zabbix_stat_replication_bytelag: "{{ postgres_zabbix_legacy_stat_replication_bytelag }}"
when: pg_version is version('10', '<')
tags:
- postgres
- zabbix
- name: "[zabbix] pg >= 10 specific"
set_fact:
postgres_zabbix_stat_replication_bytelag: "{{ postgres_zabbix_modern_stat_replication_bytelag }}"
when: pg_version is version('10', '>=')
tags:
- postgres
- zabbix
- name: "[zabbix] /etc/zabbix/zabbix_agentd.conf.d/postgresql_template.conf (template)"
template:
src: "zabbix_postgresql_template.conf"
dest: "/etc/zabbix/zabbix_agentd.conf.d/postgresql_template.conf"
mode: 0644
notify: restart zabbix_agent
tags:
- postgres
- zabbix
- name: "[zabbix] pg >= 13: crontab to reset the postgres SLRU stats once a day"
cron:
name: "postgres: reset SLRU stats"
hour: "00"
minute: "00"
job: 'psql -Atc "SELECT pg_stat_reset_slru(NULL)"'
user: "postgres"
when: pg_version is version('13', '>=')
tags:
- postgres
- zabbix