YAML variable without using quotes?

126 views
Skip to first unread message

RobL

unread,
Feb 17, 2016, 11:33:54 PM2/17/16
to Ansible Project
I'm hitting this error:

We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

The problem is that I'm converting the YAML to JSON, and I need the value (a number) to be unquoted in the JSON.

Is there any way I can avoid this error without quoting, or is there some way to remove the quotes when it's converted to JSON?

Brian Coca

unread,
Feb 18, 2016, 11:03:02 AM2/18/16
to ansible...@googlegroups.com
 "{{foo|int}}" should return a number


----------
Brian Coca

RobL

unread,
Feb 18, 2016, 11:17:41 AM2/18/16
to Ansible Project
No, I'm still seeing the value being quoted:

        instances: "{{ groups['workers']|count|int }}"
becomes:
       "instances": "3",

Brian Coca

unread,
Feb 18, 2016, 11:32:20 AM2/18/16
to ansible...@googlegroups.com
what version of ansible?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cf9c86d2-ade4-46a9-a8c4-0e04acbc7fe4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
----------
Brian Coca

RobL

unread,
Feb 18, 2016, 11:54:10 AM2/18/16
to Ansible Project
ansible 1.9.0.1

Brian Coca

unread,
Feb 18, 2016, 11:59:36 AM2/18/16
to ansible...@googlegroups.com
that is a bug in that version, it should work on 2.0 and above


For more options, visit https://groups.google.com/d/optout.



--
----------
Brian Coca

RobL

unread,
Feb 18, 2016, 3:43:21 PM2/18/16
to Ansible Project
I'm still seeing the same issue on Ansible 2.0.0.2.

RobL

unread,
Feb 19, 2016, 1:19:59 PM2/19/16
to Ansible Project
Brian, can you point me to the commit that should be fixing this bug?

Thanks!

RobL

unread,
Feb 23, 2016, 7:17:53 PM2/23/16
to Ansible Project
I'm still seeing a repro of the bug.  Is this the commit you're referring to?

For this bug?
Reply all
Reply to author
Forward
0 new messages