Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
An Ansible lookup plugin would be helpful to query the REST API from the APIC and directly store the returned data (list) in a task / role variable or to define an Ansible loop. Currently, an aci_rest operation is needed as a dedicated task. The problem here is, that there is no way to register a variable for aci_rest operations to store the output. Therefore, a lookup plugin would be helpful
Example usage:
tasks:
- name: "Lookup test 1"
vars:
aci_query_target_filters:
match: "and"
filters:
- attribute: "fvTenant.name"
operator: "eq"
value: "common"
ansible.builtin.debug:
msg: "{{ query('aci_lookup',
host='apic1.example.com',
port=443,
username='apic_admin',
password='apic_adminPw',
query_scope='class',
query_object='fvTenant',
query_target='self',
target_subtree_class=['fvAEPg', 'fvBD'],
query_target_filters=aci_query_target_filters) }}"
Of course, all possible REST options shall be implemented (e.g. rsp_subtree, rsp_subtree_class, ....)
New or Affected Module(s):
- Proposed lookup name:
aci_lookup
APIC version and APIC Platform
not relevant, because this is a generic approach
Collection versions
References
Community Note
Description
An Ansible lookup plugin would be helpful to query the REST API from the APIC and directly store the returned data (list) in a task / role variable or to define an Ansible
loop. Currently, anaci_restoperation is needed as a dedicated task. The problem here is, that there is no way to register a variable foraci_restoperations to store the output. Therefore, a lookup plugin would be helpfulExample usage:
Of course, all possible REST options shall be implemented (e.g.
rsp_subtree,rsp_subtree_class, ....)New or Affected Module(s):
aci_lookupAPIC version and APIC Platform
not relevant, because this is a generic approach
Collection versions
References