Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add Nutanix external inventory script #21972
Nutanix external inventory script
This is an inventory plugin for Nutanix, a 'hyper-converged' infrastructure platform. Multiple Nutanix clusters are supported. The script pulls from two APIs to generate an inventory of VMs, either by IP or VM name. Nutanix admins can specify inventory groups and hostvars by modifying the VM descriptions to contain a JSON string, the formatting of which can be found in the documentation at the top of the script.
@madeinoz67 agreed. We actually have fully working modules that we use internally at Nutanix that we use for different things inside the company, we just never upstreamed them. @mattkeeler and I are connected on email now, we'll put our heads together and see if we can tag team them. My ultimate goal is to have a fully functional module upstream, where you can do typical CRUD workflows against Nutanix prism central, using our new v3 API's that are GA'ing shortly. This gets us a lot of goodness, and is the same approach that we're taking for terraform (as an example)
My gut feeling is that "MVP" would be CRUD for VMs, VLANs, Images, and Volume Groups. Once we've got that, we can take it upstream, and iterate based on feedback
Glad to see some interest in this from the community as well as from the good folks at Nutanix! As @JonKohler mentioned, we've connected over email and plan on seeing what we can come up with.
It's worth noting that the inventory plugin that has been submitted here is for a pre-v3 API. I haven't had the chance yet to play with v3, but doubtless it would benefit the community if the plugin supported it. I think a question that needs to be answered is whether the Ansible community would benefit from an inventory plugin that supports multiple API versions, or whether this needs to be updated to support v3 only.
Jon mentioned a module that Nutanix uses internally for controlling VMs, images, volumes, etc. My friend (primary author @abb1995) and I wrote a similar module that provides similar functionality, though it's also for a pre-v3 API and was never released. We've shared that with Jon as well, and are happy to work with him and his team if they find it useful. Right now it's in a private repo, but it might be worth opening to the community if there's interest.
So I guess the major question in terms of Ansible integrating Nutanix support is whether multiple API versions ought to be supported. Thoughts?
IMHO, with brutal honesty, I want to light the old v0.8 API on fire and never talk about it again :) Anything going forward should at least be v2 API, if not v3 API.
Thats an issue at large we've been working on within Nutanix to unify these disparate API's. v2 is what we call "procedural" and v3 is "intentful". Really its a traditional command API with v2 and a declarative API with v3.
Sure, the bar is a bit higher to rewrite/refactor, but I think its for the best if all of these toolsets walk the same code path