# Vmware\_guest is not changing guest\_id

**URL:** <https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106>\
**Category:** Get Help\
**Tags:** vmware, collections\
**Created:** [December 30, 2023, 1:18pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106 "2023-12-30T13:18:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bor](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bor/32/1258_2.png) [@Bor](https://forum.ansible.com/u/Bor)\
**Post date:** [December 30, 2023, 1:18pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/1 "2023-12-30T13:18:15Z")

</div>

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:

```yaml
- 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.

Any ideas what is going wrong here? Thanks!

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [December 31, 2023, 8:31am UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/2 "2023-12-31T08:31:24Z")

</div>

Hello,

I just had the chance to try it on a vsphere 7u3 using the `community.vmware:=2.9.1` collection. It worked as expected:

```yaml
    - name: Change Guest ID
      community.vmware.vmware_guest:
        # uuid: "{{ vm_info.instance.hw_product_uuid }}"
        guest_id: other5xLinux64Guest
        hostname: esxi.beri.lab
        username: root
        password: ******
        validate_certs: false
        name: Ubuntu-VM
      delegate_to: localhost
      delegate_facts: true

```

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/5/5ec626a08fb2babdd062e96a6af14bcff4e784f1.png)

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/0/0da00357e78a4122e8290e14bb7f295c340bce90.png)

Anyway, since you’re on 8u2, and I’m on 7u3, there might be differences on how the API treats the guestId config.

I’d try to update the [community.vmware](https://galaxy.ansible.com/ui/repo/published/community/vmware/) collection to its latest version (4.0.1 as of today) if you have not done it yet:

```auto
ansible-galaxy collection install community.vmware --force

```

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).

---

<div class="post-metadata">

**Author:** ![Bor](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bor/32/1258_2.png) [@Bor](https://forum.ansible.com/u/Bor)\
**Post date:** [December 31, 2023, 1:40pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/3 "2023-12-31T13:40:54Z")

</div>

Thanks, I’ll try out your suggestions.

One remark on the difference besides the version, is that you directly target your esx server instead of going through vcenter cluster.

I’ll try that too.

---

<div class="post-metadata">

**Author:** ![Bor](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bor/32/1258_2.png) [@Bor](https://forum.ansible.com/u/Bor)\
**Post date:** [December 31, 2023, 1:49pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/4 "2023-12-31T13:49:37Z")

</div>

Wow oke weirdness!

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.

Either way, problem disappeared.

---

<div class="post-metadata">

**Author:** ![jbericat](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jbericat/32/627_2.png) [@jbericat](https://forum.ansible.com/u/jbericat)\
**Post date:** [December 31, 2023, 3:52pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/5 "2023-12-31T15:52:53Z")

</div>

> [@Bor](#):
>
> Wow oke weirdness!

Hahaha welcome to the amazing world of computer science, I guess 😅

Thanks for letting us know that you were able to “fix” it, btw. See you around!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [January 30, 2024, 3:53pm UTC](https://forum.ansible.com/t/vmware-guest-is-not-changing-guest-id/3106/6 "2024-01-30T15:53:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
