You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Is there any other method to update the Guest OS via Ansible? I'm deploying a 2025 server from a template made by Packer - the VM had the descriptor for 2022 OS on vSphere 7.x, but the OVA has the descriptor for 2025 which isn't supported on 7.x. I need to set the descriptor back to 2022 to power on the VM deployed from OVA using vmware.vmware_rest.vcenter_ovf_libraryitem.
Update: using a PowerCLI script to set the GuestId
Set-VM -VM $vm -GuestId "{{ guest_os }}" -Confirm:$false;
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.
The text was updated successfully, but these errors were encountered: