and 2 years later ...
: )
On Friday, 30 September 2016, Marc Tamsky <[email protected]> wrote:
> On Friday, December 19, 2014 at 7:50:09 AM UTC-8, Dario Bertini wrote:
>>
>> I was thinking of simply using
>>
>> ansible -m debug -a "msg={{the_jinja_expression_I_want_to_test}}"
>>
>> but I realized that the output is not quite what I'd expect:
>>
>> ansible -m debug -a "msg={{hostvars[inventory_hostname]}}"
>>
>> ansible -m debug -a "msg={{hostvars}}"
>>
>
> I agree it's not totally obvious.
>
> The answer at http://serverfault.com/a/695798 helped me figure out that
> it needed to be quoted.
>
> quote your test expressions and you get the output you expected:
>
>
> # ansible --version
> ansible 1.9.6
> configured module search path = None
>
> # ansible -m debug -a msg="'{{hostvars[inventory_hostname]}}'"
> localhost | success >> {
> "msg": "{'inventory_hostname': '127.0.0.1', 'group_names':
> ['ungrouped'], 'inventory_hostname_short': '127'}"
> }
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/Xatc4EFoO84/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected]
> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/e2a7b30c-bf79-4ace-b9b8-2419593290a8%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/e2a7b30c-bf79-4ace-b9b8-2419593290a8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAMP%3DowgD-WYZcgvEjzfS%3D2DvaO0Wf3LQQRpP3hOMdPrhvwihqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.