Is there any way to use ansible to create MySQL table in RDS? According to mysql_db module page, "target" should specify the location of the file on "remote" host. In case of RDS, I don't think I can put file on RDS instance.
Thanks in advance
You can reference the file from the localhost
- hosts: localhost
sudo: no
connection: local
tasks:
- name: Run SQL commands against DB to create table
mysql_db:
login_host: "{{ DB_HOST }}"
login_password: "{{ DB_PASSWORD }}"
login_user: "{{ DB_USER }}"
login_port: "{{ DB_PORT }}"
name: "{{ DB_NAME }}"
state: import
target: "{{ path_to_my_sql_files_on_ansible_machine }}/create.sql"