Thank you very much!!

On Wednesday, 30 November 2016 12:24:41 UTC-5, Ted Zlatanov wrote:
>
> On Wed, 30 Nov 2016 09:02:45 -0800 (PST) Mumshad Mannambeth <
> [email protected] <javascript:>> wrote: 
>
> MM>            with_dict: 
> MM>                  "{'{{var1}}': '{{value1}}'}" 
>
> MM> But item is in key:value format {key: var1, value: value1} , instead I 
> need 
> MM> it in format - { var1 : value1 } 
>
> Just make the constructed parameters a list of maps: 
>
> #+begin_src ansible 
> #!/usr/bin/ansible-playbook 
>
> - hosts: localhost 
>   tasks: 
>     - set_fact: 
>         var1: x 
>         value1: 100 
>         var2: y 
>         value2: 200 
>
>     - debug: var=item 
>       with_items: "{{ [ { var1: value1 }, { var2: value2 } ] }}" 
> #+end_src 
>
> Output: 
>
> #+begin_src text 
> TASK [debug] 
> ******************************************************************* 
> ok: [localhost] => (item={u'x': 100}) => { 
>     "item": { 
>         "x": 100 
>     } 
> } 
> ok: [localhost] => (item={u'y': 200}) => { 
>     "item": { 
>         "y": 200 
>     } 
> } 
> #+end_src 
>
>

-- 
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/92415a27-969b-4247-8df9-ffa47fc432d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to