Hi,
I have the bellow task that I’m trying to modify in order to work with a MySQL server AND Amazon RDS :
“”"
- hosts: mydb
connection: local
user: root
gather_facts: false
vars_files:
-
myvars.yml
-
name: import database
mysql_db: login_host={{ DB_ADDRESS }} login_user={{ DB_MASTER_USERNAME }} login_password={{ DB_MASTER_PASSWORD }} name=mydb state=import target=roles/dbserver/templates/mydb.sql.j2
“”"
In case of Amazon RDS this works with no problem as it’s importing the database directly from the system where I’m running Ansible (roles/dbserver/templates/mydb.sql.j2) using the “connection:local” but the problem is if I want to use the exact same task on a remote mysql server which is not RDS I can’t use the connection local. I will have first to copy the mydb.sql.j2 template to the remote system (which is not possible in case of an RDS) in order for the import to work .
Is it possible to make the import works for both cases in a single task ?
Regards,
Nicolas.