Create backup for mysql databases on minisforum.

This commit is contained in:
2025-04-24 10:48:02 +02:00
parent ed16363255
commit 4f6df4cfc8

View File

@@ -30,10 +30,7 @@
label: "{{ item.name }}"
- name: Create backup of mysql 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 }} mysqldump -u{{ item[1].user }} -p{{ item[1].pass }} {{ item[1].name }} > {{ backup_location }}{{ item[0].name }}/{{ item[1].container }}-{{ ansible_date_time.iso8601_basic_short }}.sql
when: item[1].type == "mysql"
loop: "{{ containers | subelements('database', skip_missing=True) }}"
loop_control: