Skip to content

guest_OS not updated on VM #427

@mgollo

Description

@mgollo
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
  • Bug Report
COMPONENT NAME

vmware.vmware_rest.vcenter_vm

ANSIBLE VERSION
ansible [core 2.15.4]
  config file = None
  configured module search path = ['/Users/martin.gollowitzer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/martin.gollowitzer/code/venv/ansible-vcenter-test/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/martin.gollowitzer/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/martin.gollowitzer/code/venv/ansible-vcenter-test/bin/ansible
  python version = 3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/martin.gollowitzer/code/venv/ansible-vcenter-test/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
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.

TASK [debug os upgrade result] *****************************************************************************************************************************************************
ok: [localhost] => {
    "msg": {
        "changed": false,
        "failed": false,
        "id": "vm-XXXXXX",
...
            "guest_OS": "RHEL_7_64",
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedUsed when issue is blocked by so other issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions