Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guest_OS not updated on VM #427

Open
mgollo opened this issue Sep 22, 2023 · 1 comment
Open

guest_OS not updated on VM #427

mgollo opened this issue Sep 22, 2023 · 1 comment
Labels
blocked Used when issue is blocked by so other issue

Comments

@mgollo
Copy link

mgollo commented Sep 22, 2023

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",
...
}
@machacekondra
Copy link

Indeed, it's not possible to update guest_OS via VMware REST API. So we are blocked by the API.

@machacekondra machacekondra added the blocked Used when issue is blocked by so other issue label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Used when issue is blocked by so other issue
Projects
None yet
Development

No branches or pull requests

2 participants