ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
337 stars 332 forks source link

Manage objects in a Content Library #1537

Open balnbibarbi opened 1 year ago

balnbibarbi commented 1 year ago
SUMMARY

Ability to add/remove/replace/retrieve items in a given Content Library

ISSUE TYPE
COMPONENT NAME

community.vmware.vmware_content_library_items

ADDITIONAL INFORMATION

How it would be used:

Why it is needed:

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
balnbibarbi commented 1 year ago

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.

mariolenz commented 1 year ago

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.

balnbibarbi commented 1 year ago

Thanks Mario, got it, items not objects.

stackprotector commented 1 year ago

Workarounds until implemented:

VladoPortos commented 1 year ago

This would be super useful to have, going the rest api route now :(

balnbibarbi commented 1 year ago

I updated object -> item.

mbx64 commented 5 months ago

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"
balnbibarbi commented 5 months ago

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.

mbx64 commented 5 months ago

@balnbibarbi Yes, it looks OK to me.

rgadwagner commented 5 months ago

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.

neevnuv commented 4 months ago

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?

ihumster commented 4 months ago

@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.)