When running vmware.vmware_rest.vcenter_vm on an existing, powered-off VM with a new value for guest_OS, the guest operating system of the machine is not updated.
Collection Version
------------------ -------
vmware.vmware_rest 2.3.1
# /Users/martin.gollowitzer/code/venv/ansible-vcenter-test/lib/python3.11/site-packages/ansible_collections
Collection Version
------------------ -------
vmware.vmware_rest 2.3.1
CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less
OS / ENVIRONMENT
Playbook was run on macOS against VMware vCenter version7.0.3
STEPS TO REPRODUCE
A VM that was installed with RHEL 8, but a guest_OS setting of RHEL_7_64 when RHEL_8_64 was not yet available due to an older version of vSphere. The machine was powered off and should have been updated using the following task within the playbook:
---
- name: "lookup MoID of {{ item }}"
set_fact:
moid: "{{ lookup('vmware.vmware_rest.vm_moid', '/DC/vm/folder/' + item ) }}"
- name: "Get VM info for {{ item }}"
vmware.vmware_rest.vcenter_vm_info:
vcenter_validate_certs: false
vm: "{{ moid }}"
register: vm_info
- name: "Shut down {{ item }} via OS after successful upgrade"
vmware.vmware_rest.vcenter_vm_guest_power:
vcenter_validate_certs: false
state: shutdown
vm: "{{ moid }}"
- name: "Wait until {{ item }} is off"
vmware.vmware_rest.vcenter_vm_info:
vm: '{{ moid }}'
register: vm_post_off_info
until:
- vm_post_off_info is not failed
- vm_post_off_info.value.power_state == "POWERED_OFF"
retries: 60
delay: 10
- name: "Change operating system of {{ item }} to RHEL 8 if necessary"
vmware.vmware_rest.vcenter_vm:
vcenter_validate_certs: false
guest_OS: "RHEL_8_64"
vm: "{{ moid }}"
state: "present"
register: os_change
when:
- vm_info.value.guest_OS == "RHEL_7_64"
EXPECTED RESULTS
The guest_OS should have the new value.
ACTUAL RESULTS
The tasked reported no changes. The VM settings remained unchanged.
SUMMARY
When running vmware.vmware_rest.vcenter_vm on an existing, powered-off VM with a new value for guest_OS, the guest operating system of the machine is not updated.
ISSUE TYPE
COMPONENT NAME
vmware.vmware_rest.vcenter_vm
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Playbook was run on macOS against VMware vCenter version7.0.3
STEPS TO REPRODUCE
A VM that was installed with RHEL 8, but a guest_OS setting of RHEL_7_64 when RHEL_8_64 was not yet available due to an older version of vSphere. The machine was powered off and should have been updated using the following task within the playbook:
EXPECTED RESULTS
The guest_OS should have the new value.
ACTUAL RESULTS
The tasked reported no changes. The VM settings remained unchanged.