ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
348 stars 337 forks source link

vmware_deploy_ovf task does not pass autoconfigure settings to the deployed VM when deploying OVA to a v7.0 vCenter #1424

Open wittling opened 2 years ago

wittling commented 2 years ago
SUMMARY

We are using this vmware_deploy_ovf.py module to attempt to deploy a vCenter OVA, connecting to a vCenter 7.0 for the deployment. The virtual machine deploys, but none of the settings (i.e. root password, ssh enabled) are getting set. So we are having to hand-configure the vCenter after it is deployed. I did pull patch 845 (enabled_hidden_properties) and while this patch DID get rid of the "user configurable" error when we set AutoConfig to True, the VM still is not absorbing any of the settings defined in the task yaml for vmware_deploy_ovf.

ISSUE TYPE
COMPONENT NAME

vmware_deploy_ovf

ANSIBLE VERSION
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
COLLECTION VERSION
the collection version is 2.7.0, verified by the MANIFEST.json file.
CONFIGURATION
OS / ENVIRONMENT

CentOS 7 Virtual Machine on vSphere/ESXi 7

STEPS TO REPRODUCE
# deploy VCSA OVF
- name: test deploy the vcenter OVF
  community.vmware.vmware_deploy_ovf:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_user }}'
    password: '{{ vcenter_token }}'
    datacenter: '{{ vcenter_dc }}'
    cluster: '{{ vcenter_cluster }}'
    datastore: '{{ vcenter_datastore }}'
    name: '{{ vcsa_name }}'
    disk_provisioning: 'thin'
    fail_on_spec_warnings: "no"
    #fail_on_spec_warnings: "yes"
    resource_pool: "Resources"
    networks: '{{ network_map }}'
    power_on: Yes
    ovf: '{{ vcsa_ovf }}'
    validate_certs: no
    wait: '{{ vcsa_poweron_wait }}'
    wait_for_ip_address: '{{ vcsa_ip_wait }}'
    inject_ovf_env: True
    enable_hidden_properties: True
    properties:
      DeploymentOption.value: '{{ vcsa_size }}'
      guestinfo.cis.appliance.net.addr.family: 'ipv4'
      guestinfo.cis.appliance.net.mode: 'static'
      guestinfo.cis.appliance.net.addr: '{{ vcsa_ip_addr }}'
      guestinfo.cis.appliance.net.pnid: '{{ vcsa_name }}.cox.net'
      guestinfo.cis.appliance.net.prefix: '{{ vcsa_net_prefix }}'
      guestinfo.cis.appliance.net.gateway: '{{ vcsa_net_gateway }}'
      guestinfo.cis.appliance.net.dns.servers: '{{ vcsa_dns_servers }}'
      guestinfo.cis.appliance.net.root.passwd: '{{ vcsa_root_token }}'
      guestinfo.cis.appliance.net.ssh.enabled: 'true'
      guestinfo.cis.appliance.net.ntp.servers: '{{ vcsa_ntp_server1 }}'
      guestinfo.cis.ceip.enabled: 'False'
      guestinfo.cis.deployment.autoconfig: 'True'
      guestinfo.cis.vmdir.password: '{{ vcsa_admin_token }}'
      domain: '{{ vcsa_domain }}'
      searchpath: '{{ vcsa_domain }}'
  delegate_to: localhost

- name: Wait for VCSA to boot and initialize
  vmware_about_facts:
    hostname: '{{ vcsa_ip_addr }}'
    username: '{{ vcenter_user }}'
    password: '{{ vcsa_admin_token }}'
    validate_certs: 'no'
  delegate_to: localhost
  retries: 20
  delay: 60
  register: result
  until: result is succeeded
EXPECTED RESULTS

Because AutoConfig is set to True (and enable_hidden_properties is set to True which is the patch from Pull 845), I expected all of the properties to get set in the VM, specifically, root password, admin password, ssh enabled, et al.

ACTUAL RESULTS

The VM does boot up, and after you wait for the OS to finish its initialization, it presents a login screen that says "Root Passsword Not Set". And, if you try to ssh, you get a Connection Refused error, indicating that the ssh was not enabled. This indicates that none of the defined properties in the yaml are getting set in the VM. Meanwhile, the Ansible task that loops and attempts to connect every 60 seconds or so, does a countdown from 20 attempts to 0. We can reach the VM on its 5443 port, and run a manual configuration, but of course we are trying to automate this process with Ansible.

wittling commented 2 years ago

I now see that there is another issue recorded on this: https://github.com/ansible/ansible/issues/50299 I can always untar the OVA, and fix the OVF, recalculate the SHA256 and re-package it, but man, that is NOT something I want to do because it is a klugic solution.