Inventory plugin (DCNE-302)
Report all devices which are part of the fabric.
Example shows how to have all spines, leafs and controller in groups.
fixes #720
Hi @p3ck, some initial comments from my end. I am not familiar with inventory plugins development yet so might ask a bit more questions. I will in parallel also look into the https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html#developing-inventory and the code https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/inventory/init.py. This will likely take a bit more time from my end.
Also - If you're like me and wondering how to see the ansible docs for an inventory plugin you have to change the type...
ansible-doc -t inventory cisco.aci.aci_inventory
I didn't realize this at first. :-)
please fix sanity issues
@p3ck How is this plugin different from the information we're able to query using the below modules? As @akinross mentioned there's also a dedicated module called aci_system for the same purpose. Can this plugin be leveraged anyway outside of Ansible? Thanks!
--- - name: Query topSystem class in ACI hosts: aci gather_facts: no tasks: - name: Query topSystem class cisoc.aci.aci_rest: host: "{{ ansible_host }}" username: "{{ aci_username }}" password: "{{ aci_password }}" path: "/api/class/topSystem.json" method: get validate_certs: false register: top_system_response - name: Display topSystem information debug: var: top_system_response.responseOR
- name: Query all controllers system information cisco.aci.aci_system: host: apic username: userName password: somePassword validate_certs: false state: query
The difference is it's available as an inventory source. The request for this plugin was for inventory tracking in Ansible Automation Platform. HTH
Ping - Are we good here? Can we merge? Thanks
Hi @p3ck, waiting on feedback from @lhercot.
I have a few issues with this plugin that I would like addressed before we take in this code:
-
We need to decide if this plugin is aci_inventory or aci_inventory_system / aci_system_inventory. What I mean is that if this inventory plugin scope is to retrieve leaf, spines and controllers (nodes using topSystem class) and format them for inventory then we should make this plugin name more specific as I foresee a future where we will have more inventory plugins for other use cases (CDP/LLDP Neighbors, tenans, service devices, ...). On the other hand, if this plugin will be the all in be all inventory plugin we then need to allow the class types to be defined and expose a bunch of other options.
-
How do we test this inventory plugin in our CI pipeline and make sure we do not introduce a regression in the future as this PR does not seems to include any test (unit or integration)? I do not see any documentation from Ansible/RedHat on how to test and validate inventory plugins.
-
We need to open a enhancement issue to track the addition of certificate based authentication. (this is not blocking just a note once we take on this code)