Skip to content

Commit 8d4efca

Browse files
authored
Update dump_databases role to match new setup (#490)
1 parent 7181527 commit 8d4efca

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# Dump Databases
22

33
Perform 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)).

Ansible/roles/dump_databases/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
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
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
---
22
# vars file for dump_databases
3+
4+
podman_user: "service"

0 commit comments

Comments
 (0)