Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Ansible Error couldn't resolve module vmware.vmware_rest

After resolving error VMware ansible Error couldn't resolve module community.vmware, I faced another error while upgrading hardware version on the VMware Virtual Machines, while using ansible vmware.guest in the task. Which derived from main module/plugin vmware.vm_rest. Below is the test template.

---
- name: VMWare tasks
  hosts: localhost
  connection: local
  gather_facts: no
  vars:
	  vcIP: 'vcIP'
	  vcUSR: 'vcUSER'
	  vcPASS: 'vcPASS'
  
  tasks:
	  - name: Gather all registered virtual machines
	    community.vmware.vmware_vm_info:
		    hostname: '{{ vcIP }}'
		    username: '{{ vcUSER }}'
		    password: '{{ vcPASS}}'
		    vm_type: vm
		    validate_certs: no
	    delegate_to: localhost
	    register: vminfo
  
	  - name: Change hardware version
	    vmware_guest:
		    hostname: "{{ vcIP }}"
		    username: "{{ vcUSER }}"
		    password: "{{ vcPASS }}"
		    name: "{{ item.guest_name }}"
		    hardware:
		      version: 15
		    validate_certs: False
      delegate_to: localhost
      loop: '{{ vminfo.virtual_machines }}'
	    register: vmhwversion
	  
	  - debug: 
		    var: vmhwversion  

This is what the error looks like it says module or action vmware.vmware_rest.vcenter_vm_hardware missing or misspelled.

vmware vsphere esxi vcenter ansible-playbook yml yaml inventory ansible playbook vmware.vmware_rest.vcenter_vm_hardware module missing incorrect module path automation devops scripting.png

[root@centos02 ansible]$  ansible-playbook update.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! couldn't resolve module/action 'vmware.vmware_rest.vcenter_vm_hardware'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/ansible/update.yml': line 91, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - name: Upgrade the VM hardware version
      ^ here

To resolve this install collection module vmware.vmware_rest using ansible-galaxy command.

linux centos redhat ansible vmware vsphere vcenter esxi ansible-galaxy collection install vmware.vmware_rest ansible-playbook depedency map ansible_collections rest api automation devops.png

[root@centos02 ansible]$  ansible-galaxy collection install vmware.vmware_rest
Process install dependency map
Starting collection install process
Installing 'cloud.common:1.1.0' to '/root/.ansible/collections/ansible_collections/cloud/common'
Installing 'vmware.vmware_rest:1.0.1' to '/root/.ansible/collections/ansible_collections/vmware/vmware_rest'

Userful Articles
Getting started Ansible AWX tower for IT automation run first playbook
Ansible for VMwary Using vmware_vm_inventory dynamic inventory plugin
Ansible selectattr The error was TemplateRuntimeError no test named 'equalto'
ansible create an array with set_fact
Ansible get information from esxi advanced settings nested dictionary with unique keynames
Install Ansible AWX Tower on Ubuntu Linux
Ansible AWX installation error Cannot have both the docker-py and docker python modules
Ansible AWX installation error docker-compose run --rm --service-ports task awx-manage migrate --no-input
docker: Got permission denied while trying to connect to the Docker daemon socket
Ansible AWX Tower create Manual SCM (Source Control Credential Type) project
Reset Ansible AWX Tower admin password

Go Back

Comment

Blog Search

Page Views

12273579

Follow me on Blogarama