Ansible playbook to copy database dump file to remote host and restore it to another database

0 votes
I was wondering if anybody could help me out in writing a playbook for copying database dump file to a remote host and restore it to another database. Thanks in advance.
Aug 8 in Ansible by Pavan
112 views

1 answer to this question.

0 votes

Hey @Pavan, you can use the following task for your playbook:

- name: Copy database dump file
  copy:
    src: dump.sql.bz2
    dest: /tmp
- name: Restore database
  mysql_db:
    name: my_db
    state: import
    target: /tmp/dump.sql.bz2

There are two tasks, one for transferring data to the remote and the other for restoring.

answered Aug 8 by Kalgi
• 42,510 points

Related Questions In Ansible

0 votes
1 answer

Ansible playbbok to copy files from one node to another remote node

You can create a playbook for copying ...READ MORE

answered Jan 16 in Ansible by Danica
464 views
0 votes
1 answer

Ansible playbook for moving files from one node to another remote node

The best way to do this is: copy ...READ MORE

answered Jan 16 in Ansible by Nigya

edited Jan 18 by Vardhan 1,279 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
216 views
0 votes
1 answer
0 votes
1 answer