Rename paths and backup files.
This commit is contained in:
@@ -34,22 +34,22 @@
|
||||
label: "{{ item.item }}"
|
||||
|
||||
- name: Backup container volumes
|
||||
shell: docker run --rm -v {{ backup_dir }}/{{ item.key }}:/backup --volumes-from {{ item.value.container }} busybox tar cvfz /backup/gitea.tar.gz {{ item.value.path }}
|
||||
shell: docker run --rm -v {{ backup_dir }}/{{ item.value.container }}:/backup --volumes-from {{ item.value.container }} busybox tar cvfz /backup/{{ item.key }}-{{ ansible_date_time.iso8601_basic_short }}.tar.gz {{ item.value.path }}
|
||||
loop: "{{ lookup('dict', volumes) }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
|
||||
|
||||
- name: Backup mysql databases
|
||||
shell: docker exec mysql8 mysqldump -u{{ mysql_user }} -p{{ mysql_password }} {{ item }} > {{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
shell: docker exec mysql8 mysqldump -u{{ mysql_user }} -p{{ mysql_password }} {{ item }} > {{ backup_dir }}/{{ item }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
loop: "{{ mysql_databases }}"
|
||||
|
||||
- name: Backup postgres databases
|
||||
shell: docker exec psql14 pg_dump -U {{ postgres_user }} {{ item }} > {{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
shell: docker exec psql14 pg_dump -U {{ postgres_user }} {{ item }} > {{ backup_dir }}/{{ item }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
loop: "{{ postgres_databases }}"
|
||||
|
||||
- name: Compress database backup files
|
||||
shell: gzip {{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
shell: gzip {{ backup_dir }}/{{ item }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql
|
||||
loop: "{{ databases }}"
|
||||
|
||||
- name: Check logrotate directories
|
||||
|
||||
Reference in New Issue
Block a user