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

VM deployment fails if "Computer name" in customization specification is set to "Ask User" #2014

Open
meis4h opened this issue Feb 28, 2024 · 0 comments

Comments

@meis4h
Copy link

meis4h commented Feb 28, 2024

SUMMARY

We use generic guest customization specifications for Windows hosts in our vCenters with the guest hostname being prompted on VM deployment.
When deploying a VM using the community.vmware.vmware_guest module I'd expect to be able to give it the name using the customization field but instead I get an error.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.vmware.vmware_guest

ANSIBLE VERSION
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.5 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3.11)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# /usr/share/ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.vmware 4.2.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
  • Ansible Execution Environment based on RHEL UBI 9
  • vSphere version 7.0.3.01400
STEPS TO REPRODUCE
  1. Create a VM customization specification for Windows with the Comuter name option set to "Enter a name in the Clone/Deploy wizard"
  2. Create a new VM using the community.vmware.vmware_guest module with the customization_spec set to the newly created VM customization specification
  3. (optional) retry with the customization/hostname option set
- name: Deploy test VM
  hosts: all
  gather_facts: false
  tasks:
    - name: Clone virtual machine from a template
      community.vmware.vmware_guest:
        hostname: "{{ ansible_vmware_host }}"
        username: '{{ ansible_vmware_user }}'
        password: '{{ ansible_vmware_password }}'
        validate_certs: false
        datacenter: "{{ vcenter_vm_datacenter }}"
        cluster: "{{ vcenter_vm_cluster }}"
        folder: "{{ vm_deploy_folder | regex_replace('/$', '') }}"
        name: "{{ inventory_hostname }}"
        template: "{{ vm_deploy_template }}"
        customization_spec: "MS Windows Server 2022 STD"
        customization:
          hostname: test
        state: present
      delegate_to: localhost
EXPECTED RESULTS

VM is created with guest customization spec applied

ACTUAL RESULTS

Playbook fails with error FAILED! => {"changed": false, "msg": "Failed to create a virtual machine : A specified parameter was not correct: hostname"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant