Couldn't resolve module/action 'community.vmware.vmware_rest

Hi,

I have installed the vmware_rest collection using:
ansible-galaxy collection install vmware.vmware_rest

It is visible with:
ansible-galaxy collection list
vmware.vmware_rest 2.3.1

Is it located in:
/home/ansible/.ansible/collections/ansible_collections/vmware

But somehow I still get this error.

My config is:

ansible-playbook [core 2.16.5]
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/home/ansible/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True

The dir /home/ansible/.ansible/plugins/modules is empty :frowning:
Should this be filled?

The task i use:

tasks:
- name: Connect to vCenter
community.vmware.vmware_rest:
hostname: “vcenter1”
username: “admin”
password: “password”
validate_certs: no
api_retry_timeout: 300
timeout: 60
delegate_to: localhost
register: vcenter_connection

Hi,

It looks like you have incorrectly referrenced the collection and module in your task.
‘vmware’ is the namespace, ‘vmware_rest’ is the collection name, and then you need to specify the module you wish to use that exists within the colllection, of which you can obtain the list from vmware.vmware_rest plugin list.

There is also a ‘community.vmware’ collection, in which case you would need to install that collection and then reference the modules available from the list community.vmware plugin list

For example:

- name: Get VM Info
  vmware.vmware_rest.vcenter_vm_info:
    vcenter_hostname: my-vcenterhost
    vcenter_password: password
    vcenter_username: username
    vm: my-vm

Hope that helps.

1 Like