File tree Expand file tree Collapse file tree
Ansible/roles/dump_databases Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Dump Databases
22
33Perform a dump of my databases and delete all dumps older than a week.
4+
5+ ## Variables
6+
7+ The following variable is defined in ` vars/main.yml ` :
8+
9+ - podman_user: ` service ` (name of the user running the podman database(s) container(s)).
Original file line number Diff line number Diff line change 33
44- name : " Dump the Zabbix database"
55 ansible.builtin.shell :
6- cmd : set -o pipefail && docker exec -t postgres-zabbix pg_dumpall -c -U $(cat /opt/ postgres/zabbix/env/user) -l $(cat /opt/ postgres/zabbix/env/database) | tee /opt/ postgres/zabbix/backup/$(date +%d-%m-%Y).dump
6+ cmd : machinectl shell "{{ podman_user }}"@ /bin/bash -lc " set -o pipefail && podman exec -t postgres-zabbix pg_dumpall -c -U $(cat /data/podman/volumes/ postgres/zabbix/env/user) -l $(cat /data/podman/volumes/ postgres/zabbix/env/database) | tee /data/podman/volumes/ postgres/zabbix/backup/$(date +%d-%m-%Y).dump"
77 register : dump_zabbix_database
88 changed_when : true
99
1010- name : " List old dumps of the Zabbix database"
1111 ansible.builtin.find :
12- paths : /opt /postgres/zabbix/backup
12+ paths : /data/podman/volumes /postgres/zabbix/backup
1313 patterns : ' *.dump'
1414 age : 1w
1515 register : list_old_dumps_zabbix
Original file line number Diff line number Diff line change 11---
22# vars file for dump_databases
3+
4+ podman_user : " service"
You can’t perform that action at this time.
0 commit comments