Hi all,
I have the below task which requires to call a rest API in order to call
another API.
Basically i have a dict of portgroups which i will need to call an API to
get the ID from. {{ portgroupID }}
Then run the below code.
I guess i could do it in a separate task, but then how do i link the ID
with item.portgroup_name? Is there any easy way? provided that these are
coming from different sources?
- name: Creating Mac Discovery Pol Binding
uri:
url: "https://{{ hostname }}/policy/api/v1/infra/segments/nsx-{{
item.portgroup_name | replace(' ', '-')
}}/segment-discovery-profile-binding-maps/{{ portgroupID }}
force_basic_auth: yes
validate_certs: False
headers:
Accept: "application/json"
Content-Type: "application/json"
user: "{{ username }}"
password: "{{ password }}"
method: PATCH
body: "{{ lookup('file','files/macbind.json') }}"
status_code: "200"
body_format: json
with_items: "{{ jsondata.dvs_portgroup_info[lookup('vars', 'dvsName')] }}"
when:
- item.portgroup_name.find('DVUplinks') == -1
- item.portgroup_name.find('nsx-') == -1
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7e4d0efd-d9f8-441e-b096-5171843e0fdbn%40googlegroups.com.