community.vmware
community.vmware copied to clipboard
Manage objects in a Content Library
SUMMARY
Ability to add/remove/replace/retrieve items in a given Content Library
ISSUE TYPE
- Feature Idea
COMPONENT NAME
community.vmware.vmware_content_library_items
ADDITIONAL INFORMATION
How it would be used:
- Add an item to a given CL
- Retrieve at item from a given CL
- Enumerate items in a given CL
- Remove an item from a given CL
- Replace an existing item in a given CL with a new supplied version
Why it is needed:
- This would enable upload/update of OVA templates for VMs, prior to creating VMs from those templates, for example using the existing community.vmware.vmware_content_deploy_ovf_template
- Cannot find any existing way to do this in documentation or in Jira tickets
- I did find a ticket regarding enumerating the objects in a content library: https://github.com/ansible-collections/community.vmware/issues/1220
To upload an item:
community.vmware.vmware_content_library_items:
- content_library: "abc123"
- item: "my_awesome_template.ova"
- state: present
- file: "my_local_file.ova"
To retrieve an item:
community.vmware.vmware_content_library_items:
- content_library: "abc123"
- item: "my_awesome_template.ova"
- state: download
- file: "my_local_file.ova"
To delete an item:
community.vmware.vmware_content_library_items:
- content_library: "abc123"
- item: "my_awesome_template.ova"
- state: absent
I'm intending to add this functionality, but I want to make certain it's not already present first, and to design it consistently with the existing modules.
It looks like we don't have this functionality in this collection yet. I've checked vmware.vmware_rest, and it looks like it's missing there also. That said, I think it would be a good idea to implement this :-)
One thing, though: I think both the UI and the API use the word item, not object. So maybe vmware_content_library_items
might be a better name for the module.
Thanks Mario, got it, items not objects.
Workarounds until implemented:
-
New-ContentLibraryItem
/Set-ContentLibraryItem
in PowerCLI - Using the REST API (painful)
This would be super useful to have, going the rest api route now :(
I updated object
-> item
.
This:
community.vmware.vmware_content_library_items:
- content_library: "abc123"
- item: "my_awesome_template.ova"
- state: present
- file: "my_local_file.ova"
should probably look like this:
community.vmware.vmware_content_library_item:
content_library: "abc123"
name: "my_awesome_template.ova"
state: present
file: "my_local_file.ova"
- I removed the
s
from items as you will loop over this module for multiple items - I removed the dashes (wrong syntax)
- I renamed
item
toname
to be more consistent with other modules (could also be an alias) - There should probably also be the optional attribute
type
to specify ItemType (as in PowerCLI) - There should be the optional attribute
description
Heya @mbx64 , I agree, these seem like great improvements. However, no offence meant, these are somewhat cosmetic. Are you therefore generally ok with the overall design? I ask because one of the things I was wondering about was unifying this content library API and other existing APIs that deal with files/blobs, forming some kind of abstraction layer over the underlying vmware APIs. I'm not at all sure this is a good idea. I'm seeking guidance.
@balnbibarbi Yes, it looks OK to me.
A quick notification if this is still being worked on:
Content types in a Content Library are important: For instance OVA vs. Template is an exceptionally important item since with separated VCenters it's our experience that Templates CANNOT be synchronized across dispirit content libraries (content libraries on different VCenters) while OVA/OVF Content CAN be synchronized.
The capability to handle Template and OVF/OVA files makes this slightly more complicated but very much needed.
Hello, me and my team would benefit from this module. Is someone activly working on this? Are there any workaround for this that are ansible native?
@neevnuv Hello, as far as I know, no one is currently working on this module. This requires writing a module from scratch. Current maintainers simply don’t have time for this.
A workaround could be to work with CL through the REST API using the uri or get_url ansible modules. (But as noted in the discussion above, it hurts.)