Hello Ansible Community,
I'm currently facing an issue while trying to execute a Spectrum API call
using the Ansible URI module. The API call is working fine in Postman, but
when I try to replicate it in Ansible, I encounter problems.
Here's a simplified version of my Ansible playbook:
---
- hosts: your_target_hosts
tasks:
- name: Execute Spectrum API
uri:
url: "http://{{ spectrum_server }}/spectrum/restful/models"
method: POST
headers:
Content-Type: "application/xml"
body_format: raw
body: |
<rs:model-request throttlesize="5"
xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request
../../../xsd/Request.xsd ">
<rs:target-models>
<rs:models-search>
<rs:search-criteria
xmlns="http://www.ca.com/spectrum/restful/schema/filter">
<devices-only-search/>
<filtered-models>
<equals>
<attribute id="0x1006e">
<value>YourActualDeviceName</value>
</attribute>
</equals>
</filtered-models>
</rs:search-criteria>
</rs:models-search>
</rs:target-models>
<rs:requested-attribute id="0x1006e" />
<rs:requested-attribute id="0x129fa" />
</rs:model-request>
register: response
- name: Print API Response
debug:
var: response
--
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/188c0ccf-711f-4e85-a734-654f278d7898n%40googlegroups.com.