Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using variables #6

Open
jruels opened this issue Oct 3, 2017 · 1 comment
Open

Using variables #6

jruels opened this issue Oct 3, 2017 · 1 comment

Comments

@jruels
Copy link

jruels commented Oct 3, 2017

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

@elmarx
Copy link
Owner

elmarx commented Nov 13, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants