ansible-mysql-query
ansible-mysql-query copied to clipboard
Using variables
Hello, I really appreciate all the work you put into creating this module! I am trying to insert some data into a MySQL table and I think I'm running into issues with my quotations.
Below is the code I am currently using:
- hosts: localhost
connection: local
vars_files:
- vars.yml
gather_facts: yes
roles:
- mysql-query
tasks:
- name: Update deploy_times table
mysql_query:
name: "{{ DB }}"
table: "{{ DB_TABLE }}"
login_host: localhost
login_user: "{{ USERNAME }}"
identifiers:
service: "{{ APP_NAME }}-{{ BUILD_NUMBER }}"
values:
date: '"{{ ansible_date_time.date }}"'
time: "{{ ansible_date_time.time }}"
env: "{{ ENV }}"
hostname: " {{ HOST }}"
service: "{{ APP_NAME }}-{{ BUILD_NUMBER }}"
version: "{{ VERSION }}"
container_id: "{{hostvars[groups['tag_role_swarm_master'][0]].CID}}"
When I run ansible-playbook
I get the following error back.
_mysql_exceptions.OperationalError: (1054, "Unknown column 'date' in 'field list'")
Is it possible to use debug module to see the string being send to MySQL?
If not can you please provide an example of proper quotation for variables?
Thanks! -js
Sorry, I didn't see the issue until today. I'll try to look into the issue as soon as possible. Is it still relevant?