-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory module? #97
Comments
Hi @cidrbl0ck, Thank you for bringing this to our attention. I also had this topic in mind already and it would be great to have such an inventory plugin. Before it can implemented it would be great to have a collection of use cases as there are not only IPs and host names. You can also have many other properties which needs to be taken into account for building up an inventory. We can use this issue to track ideas for the implementation first. Unfortunately I will not find time in the near future to take over the implementation. It would be highly appreciated to have someone volunteering for this. |
Hey @cmeissner Totally understood. I'd like to throw my use case out there while I'm here. For my company or more specifically my team.. our networking group is just getting their feet wet in Ansible and they've been using Phpipam for the better part of 3 years now. It is the only consistent SOT we have for networking devices (think routers, switches, firewalls, etc). So far we're looking at pulling from only the Addresses controller to form a very basic inventory.yaml containing hostnames, ip's, and up to three custom_fields. One of which is custom_fields:custom_managed which is the key to inclusion. Also understood on the implementation time or lack thereof. Would this be the appropriate place to include the information/code if I stumble across something that works? |
I think this is the simplest use case but also some implementation effort is needed. Another aspect is that #72 is also related to this feature request here. As it is suggested to cut off the api interaction stuff from I started to work on this but it is much harder as expected and is not soonish available.
If you have some code I would appreciate if you open a PR to discuss the code there. Here we should discuss the idea and the use-cases but no code fragments or implementations. |
Understood, many thanks! As I said I do have a working Python script that makes use of an ENV lookup for the phpipam API token. I can change the remainder of the static variables to lookups as well and define them in a custom credential type within AAP (which I believe is the preferred method from RH above any sort of group:vars). |
Hey @cmeissner So I wanted to comment back here.. while I was not able to develop a working plugin, I do have a pretty good inventory script now if interested. Maybe it's trivial work turning a script into a plugin? I have no idea really. But I can share it if you think it'd help. |
I think it is not trivial on the first. I did some research before my first plugin was working as expected.
May I recommend to put it in a personal GitHub repo and like it in this issue? |
Here you go: https://github.com/bicarbonate/ansible_phpipam |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Is your feature request related to a problem? Please describe.
Phpipam seems to be one of those source of truth, that is ignored to a huge degree, as an inventory source. Yes, the API is useful and it's easy to make a playbook that calls and creates an inventory file. However for a lot of folks, like me, whose Python skills are quite horrible.. finding a plugin or a module to use for inventory purposes has ended in empty hands.
Describe the solution you'd like
You guys already have a nice, well-rounded Collection. Including an inventory plugin or module would be icing on the cake.
Describe alternatives you've considered
So far I've tried a playbook/template that makes an API call with various filters, to create an inventory.yaml file using a template. Also testing the ansible.builtin.script module to perform the same basic thing, except the yml calls a python script (translated from the playbook) to perform the same functions. Inventory scripts, while still technically supported, plugins are recommended by the Community and RH.
Additional context
If this functionality already exists in some form please correct me. I was not able to find anything related to this in the existing documentation.
The text was updated successfully, but these errors were encountered: