See http://pastebin.com/QWSu641w for the testing playbook I've been using.

Basically, I have several vars that I need to place inside a json string. 

The output should look something like:

{"indices": "testlogstash-2014.04.14","ignore_unavailable": 
"true","include_global_state": false,"partial": true}

Vars are not evaluated unless you use double quotes, and if I use single 
quotes, like 'indices', the json is invalid. Which means I should escape 
the appropriate double quotes. Unfortunately, ansible still returns a 
syntax error.

ERROR: Syntax Error while loading YAML script, apply.yml
> Note: The error may actually appear before this position: line 16, column 
> 29
>   - name: debug stuff
>     debug: msg="{\"indices\": \"{{ esmaintenance_indexPrefix }}{{ 
> yesterday.stdout }}\",\"ignore_unavailable\": 
> true,\"include_global_state\": false,\"partial\": true}"
>                             ^
> 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 }}"



So, I'm rather stuck...

Any suggestions?

ansible --version          
ansible 2.0.0 (devel a0def30c34) last updated 2015/04/15 11:32:13 (GMT -700)
  lib/ansible/modules/core: (detached HEAD a19fa6ba48) last updated 
2015/04/15 11:32:18 (GMT -700)
  lib/ansible/modules/extras: (detached HEAD df7fcc90d9) last updated 
2015/04/15 11:32:18 (GMT -700)
  v2/ansible/modules/core: (detached HEAD 34784b7a61) last updated 
2015/03/05 16:10:19 (GMT -700)
  v2/ansible/modules/extras: (detached HEAD df7fcc90d9) last updated 
2015/04/15 11:32:18 (GMT -700)
  configured module search path = None

-- 
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/2e3bac86-40c4-4d4a-ad8b-8b516918abab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to