Introduce backup of postgres databases.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user