The combine filter should allow you to do this:

https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#combining-hashes-dictionaries


On Thu, 20 Jun 2019 at 09:28, AD <[email protected]> wrote:

> Hello,
>
> I'm trying to update an attribute from a GET API JSON result and do a PUT
> request along with the entire API data with only one attribute change.
> Please advice on the format for PUT Req Task ?
>
> 1. Get Request for a given API call
> 2. From the above json data in step1, I need to update only one attribute:
> mipUser (From "false To "true) and do a PUT request along with the other
> data unchanged in the json.
>
>
>     - name: GET Request for CLUSTERS
>       uri:
>         url: https://zsapi.com/BETA/{{ item }}
>         method: GET
>         validate_certs: no
>         return_content: yes
>         status_code: 200
>         headers:
>           Content-Type: application/json
>           Cookie: "{{ login.set_cookie.split(';')[0] }}"
>         body_format: json
>       with_items: "{{ cluster }}"
>       register: cluster_result
>
>
>
>
> ok: [localhost] => {
>     "msg": [
>         {
>             "bandwidthControlApp": true,
>             "cloud": "BETA",
>             "createTime": 1550875210,
>             "datacenter": {
>                 "id": 526,
>                 "name": "FMT1"
>             },
>             "description": "cluster with VIP 169.254.1.100",
>             "disabled": false,
>             "id": 2334,
>             "lastModifiedTime": 1560896398,
>             "lastModifiedUser": {
>                 "id": 1009,
>                 "name": "[email protected]"
>             },
>             "mipUser": false,
>             "mtsInstances": [],
>             "name": "fmt1",
>             "rateLimit": true,
>         }
>     ]
> }
>
>
>
>
>
> --
> 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/1c09b86a-eaf1-4e42-a4d9-b75168c4e2b3%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/1c09b86a-eaf1-4e42-a4d9-b75168c4e2b3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwN_sNzCZRod9zHri4Eb-VAfaOxYjOWtrM_6XxWXg3bthA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to