Issue with executing query-file through mysql.mysql_query
I am new within ansible and it modules, so sorry if I’m just using the wrong module.
I need to run query (~7000 lines) to set up a database on my database server. I am using the mysql.mysql_query
module because it seems to be the correct module for the task (but might me wrong and getting fatal: [db-server]: FAILED! => {"changed": false, "msg": "Cannot execute SQL '(...sql-file...)'.
The db-server is running MariaDB and running ansible through AAP, and it works manually doing source /var/tmp/redcap_install.sql
, am I doing it correct or should I use another module?
- name: Move script to db-server
copy:
src: redcap_install.sql
dest: /var/tmp
- name: Create REDCap database with config
community.mysql.mysql_query:
login_db: '{{ db_name }}'
login_user: '{{ db_username }}'
login_password: '{{ database_password }}'
query: "/var/tmp/redcap_install.sql"