Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Commit

Permalink
add rescue block
Browse files Browse the repository at this point in the history
  • Loading branch information
l3d00m committed Jul 4, 2023
1 parent c330463 commit 1f5c3d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions roles/mariadb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@

- name: Flush handlers to make restoring dump possible
ansible.builtin.meta: flush_handlers
when: db_dump is not false and not dump_file.failed
when: db_dump is not false

- name: Restore dump
args:
executable: /bin/bash
ansible.builtin.shell: |
set -o pipefail
cat {{ dump_location }} | docker exec -i $(docker ps -q -f name={{ stack_name }}_mariadb) /usr/bin/mariadb -p{{ reims2_db_root_password }} {{ reims2_db_name }}
when: db_dump is not false and not dump_file.failed
when: db_dump is not false
rescue:
- name: Print error
ansible.builtin.debug:
msg: "Failed to restore dump"

0 comments on commit 1f5c3d3

Please sign in to comment.