ansible-collections / vmware.vmware_rest

Ansible Collection for VMWare (REST modules)
https://ansible-collections.github.io/vmware.vmware_rest/
GNU General Public License v3.0
132 stars 64 forks source link

How do I get all items of a content library after the changes in the version 3.0.1 to 4.0.0? #519

Closed manuel-hiller-ebm closed 2 months ago

manuel-hiller-ebm commented 3 months ago

Summary

I am trying to get all content library items in the version 4.0.0 of the collection. In the further version 3.0.1 I have done this with the following task:

- name: Get all Content Library Items
  vmware.vmware_rest.content_library_item_info:
    vcenter_hostname: "hostname"
    vcenter_username: "username"
    vcenter_password: "password"
    vcenter_validate_certs: false
    library_id: 'id_of_library'
  register: vm_create_library_items
  delegate_to: localhost

But for now I am getting the following error message:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "library_id": "['library_id']",
            "library_item_id": null,
            "session_timeout": null,
            "vcenter_hostname": "hostname",
            "vcenter_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "vcenter_rest_log_file": null,
            "vcenter_username": "username",
            "vcenter_validate_certs": false
        }
    },
    "value": {
        "error_type": "INVALID_ARGUMENT",
        "messages": [
            {
                "args": [
                    "library_id?library_id"
                ],
                "default_message": "Unsupported property with name: library_id?library_id.",
                "id": "com.vmware.vapi.rest.unsupportedProperty"
            }
        ]
    }
}

Could you please be so kind to provide me a documentation how this task looks like in the new version?

Issue Type

Documentation Report

Component Name

Module vmware.vmware_rest.content_library_item_info:

Ansible Version

$ ansible --version
ansible [core 2.17.3]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.7 (main, Jul  4 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3.11)
  jinja version = 3.1.4
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
bash-5.1$ ansible-galaxy collection list 

# /usr/share/ansible/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
ansible.netcommon                        7.0.0  
ansible.posix                            1.5.4  
ansible.utils                            5.1.0  
ansible.windows                          2.4.0  
awx.awx                                  24.6.1 
cloud.common                             3.0.0  
community.docker                         3.12.1 
community.general                        9.3.0  
community.library_inventory_filtering_v1 1.0.1  
community.vmware                         4.5.0  
community.windows                        2.2.0  
it_platform.general                      3.7.3  
prometheus.prometheus                    0.17.1 
vmware.vmware_rest                       4.0.0  

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

RHEL UBI 9 Docker Image

Additional Information

No response

Code of Conduct

mikemorency commented 3 months ago

Hi @manuel-hiller-ebm

Are you using vSphere 8 or 7? In your output, the module arg for library ID seems to have some extra characters. Im wondering if that is from you removing sensative data or if thats in your actual output?

"module_args": {
            "library_id": "['library_id]",    # there seems to be extra brackets and a single quote
manuel-hiller-ebm commented 3 months ago

Hi @mikemorency sorry for the confusions, this happened because of trying to remove the sensitive data. I corrected this in my first post. We are using Vsphere 7.

mikemorency commented 3 months ago

@manuel-hiller-ebm version 4.X is generated using the vSphere 8 API. Some modules may not work with vSphere 7. Version 3.X is still supported (we just put out a new minor version) and was generated using the vSphere 7 API so you can still use that.

manuel-hiller-ebm commented 2 months ago

@mikemorency Ok. perfect. Thank you for your clarifications and your help.