I am having some trouble with the vmware_guest modules.
I deploy an OVA (works fine) but the hardware version and guest_id’s need to be updated.
So came up with this:
- name: Gather guest info for UUID
community.vmware.vmware_guest_info:
name: "{{ inventory_hostname | split('.') | first }}"
delegate_to: localhost
register: vm_info
ignore_errors: true
- name: Turn off guest VM using UUID
community.vmware.vmware_guest:
uuid: "{{ vm_info.instance.hw_product_uuid }}"
state: poweredoff
cluster: mycluster
when: vm_info.instance is defined
delegate_to: localhost
delegate_facts: true
- name: Upgrade VM hardware version
community.vmware.vmware_guest:
uuid: "{{ vm_info.instance.hw_product_uuid }}"
hardware:
version: latest
cluster: mycluster
delegate_to: localhost
delegate_facts: true
- name: Change Guest ID
community.vmware.vmware_guest:
uuid: "{{ vm_info.instance.hw_product_uuid }}"
guest_id: other6xLinux64Guest
cluster: mycluster
delegate_to: localhost
delegate_facts: true
The Vmware environment is vSphere 8u2 supporting VM version 21.
I used the community.vmware.vmware_vm_config_option to verify I am using the correct and supported guest_id. I double checked against the vmware API documentation in case I was going crazy.
I tried different code, with UUID (above), VM names, with more/less parameters like cluster. I never get an error (it shows changed), but it never actually changes the guest_id.
You might also try to use other5xLinux64Guest or another value instead to see if the problem is related with that specific id (which was added on API 8.0.0.1).
I updated the vmware collection, reran the update playbook on 1 host and saw all output was green (OK), so unchanged. Puzzling …
Turns out my role worked all along vcenter just didn’t show it immediately (I did refresh ). I guess it just takes a while or perhaps the guests had to turn on first to reflect the change.