Im trying to SCP a .sql file from one server to another, and I am trying to use an Ansible module to do so. I stumbled across the fetch and copy modules, but I am not sure how to specify which host I want to copy the file from.
This is my current Ansible file:
firstDB database dump happens on seperate host
- hosts: galeraDatabase
become: yes
remote_user: kday
become_method: sudo
tasks:
- name: Copy file to the galera server
fetch:
dest: /tmp/
src: /tmp/{{ tenant }}Prod.sql
validate_checksum: yes
fail_on_missing: yes
Basically, I want to take the dump file from the firstDB
host, and then get it over to the other galeraDatabase
host. How would I do this? Im order to use fetch or copy, I would need to pass it the second hostname to copy the files from, and I don't see any parameters to do that inside of the documentation. Should I be using a different method altogether?
Thanks