Introduce backup of postgres databases.

This commit is contained in:
2025-04-24 12:37:12 +02:00
parent e6ba644629
commit 5ef1ec213d

View File

@@ -26,10 +26,7 @@
label: "{{ item[1].name }}"
- name: Create backup of postgres database and store to backup directory
ansible.builtin.debug:
msg:
- '{{ item[1] }}' # Database configuration @see: when
- '{{ item[0].name }}' # Container name
shell: docker exec {{ item[1].container }} pg_dump -U {{ item[1].user }} {{ item[1].name }} > {{ backup_location }}{{ item[0].name }}/{{ item[1].container }}-{{ ansible_date_time.iso8601_basic_short }}.sql
when: item[1].type == "psql"
loop: "{{ containers | subelements('database', skip_missing=True) }}"
loop_control: