On Monday, 29 October 2018 12:06:47 CET Foss Geek wrote:
> 
> It works to me.

Because you use double quotes.


> ---
> 
> - hosts: all
>   tasks:
>     - name: Generate responce with given status code
>       uri: 
>         url: "https://httpbin.org/post";
>         method: POST
>         body_format: json
>         body: "{ \"codes\": {{ item }} }"
>         return_content: yes
>       with_items:
>         - 100
>         - 200
>       register: apiresponce
> 
> 
> On Monday, October 29, 2018 at 1:06:28 PM UTC+5:30, Alberto Jimenez Lozano 
> wrote:
> >
> > I use a loop with_items, but I want to put the variable into a body of a 
> > json and it doesn´t works.
> >
> >
> > - name: Associate subscriptions ak-{{tenant}}-RHEL_7 
> >     uri:
> >        url: "
> > https://xxxxxxxx/katello/api/activation_keys/{{ak_id[0]}}/add_subscriptions
> > "
> >        user: "{{user}}"
> >        password: "{{password}}"
> >        method: PUT
> >        return_content: yes
> >        force_basic_auth: yes
> >        validate_certs: no
> >        body_format: json
> >        body: '{"subscription_id":  "{{item}}" }'

You need to use double quotes instead of single quotes.


-- 
Kai Stian Olstad


-- 
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/3655460.3eSmeE2nOB%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to