It works to me.
---
- 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}}" }'
> with_items:
> - 340
> - 343
> status_code: [200,201,202,204,301,401]
>
>
--
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/5be378de-069d-4428-ab81-c35d5c3ad2ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.