Open nebb00 opened 1 year ago
It looks like Settings Clusters Software APIs can be used to implement this.
However, since this is the REST instead of the old SOAP API, it might be better to implement this in vmware.vmware_rest which is focused on it. On the other hand, there isn't much work done in this collection and I didn't figure out yet how to implement new modules there.
Well, at the moment the priority is to release community.vmware 4.0.0. We'll try to have a look at this once this is done.
@mariolenz I studied a little how ansible_builder works, which automatically builds the vmware.vmware_rest collection. First of all, she needs swagger files describing the api in the openapi 3.0 format. These APIs are not publicly available anywhere, which means they are most likely either written manually (with which I have experience) or some other way. then they are generated in this way (I came across a project for generating json with openapi by bypassing vcsa endpoints, but it did not work correctly for me).
Yes, that's been the first problem I didn't understand: Where to get the Swagger / OpenAPI definitions for the API?
Well, maybe I'll find the time to have a closer look at this when 4.0.0 is released. That is, if there isn't too much to do in this collection.
We have some modules, based on VmwareRestClient class. And theoretically, you can create a new module on it to implement the above capabilities. But we will slide into duplicating collections...
@nebb00 I don't understand why you only want to get the cluster image. While we're at it, I think we should also try to implement setting it ;-)
This way, you could manage it via ansible. If you have a lot of clusters and want them to have the same cluster image, it can be pretty annoying to configure this manually...
cc @JoschuaA4
These APIs are not publicly available anywhere, which means they are most likely either written manually (with which I have experience) or some other way.
I think we could get he spec with vmware-openapi-generator.
I've tried to do it in ansible-collections/vmware.vmware_rest#443, but am not sure if this is really correct.
@mariolenz I couldn't get it to work. Or I don’t understand how to configure it correctly.
@ihumster Maybe you could add what you tried and the problems you ran into to ansible-collections/vmware.vmware_rest#443 so we don't clutter this issue.
I think this is quite similar to #1005
Maybe we can use something from com.vmware.esx.settings.clusters to do this :thinking:
I've ended up using the API to do what I want
Add the functionailty to export LCM cluster state including JSON and ISO exactly like the PowerCLI cmdlet using Ansible
https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/export-lcmclusterdesiredstate/#Default