Last active
October 1, 2021 11:08
-
-
Save Inderpreet90/a79f40af7cce42d53ae27760a43ac40d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Import MySQL database | |
hosts: dbhost | |
tasks: | |
- name: Start database import | |
## Assuming we already have a cnf file created with DB credentials. | |
shell: "mysql {{ MYSQL_DATABASE }} < /backups/database_dump.sql" | |
async: 2100 | |
poll: 0 | |
register: import_db | |
## Some other tasks which are irrelevant to the database import | |
- name: TASK1 | |
... | |
... | |
- name: TASK2 | |
... | |
... | |
- name: TASK3 | |
... | |
... | |
- name: Check if database import is complete | |
async_status: | |
jid: "{{ import_db.ansible_job_id }}" | |
register: job_result | |
until: job_result.finished | |
delay: 10 | |
retries: 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment