Change ownership of volume backups.

This commit is contained in:
2021-11-19 10:10:46 +01:00
parent 809acb9154
commit 992517ba85

View File

@@ -9,12 +9,6 @@
- include_vars: vars/secret.yaml
- include_vars: vars/variable.yaml
- name: Backup container volumes
debug: var=item
loop: "{{ lookup('dict', volumes) }}"
loop_control:
label: "{{ item.key }}"
- name: Check if directories exist
stat:
path: "{{ backup_dir }}/{{ item }}"
@@ -39,6 +33,9 @@
loop_control:
label: "{{ item.key }}"
- name: Change ownership of volume backups
shell: chown chris:chris {{ backup_dir }}/{{ item.value.container }}/{{ item.key }}-{{ ansible_date_time.iso8601_basic_short }}.tar.gz
become: true
- name: Backup mysql databases
shell: docker exec mysql8 mysqldump -u{{ mysql_user }} -p{{ mysql_password }} {{ item }} > {{ backup_dir }}/{{ item }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql