vmware_guest - VM is created but the name "none"

Hi folks

When i use below on a Ubuntu 20.04 ansible control node , vm is created but the OS name shows “none”

Same playbook i am running on a CentOS7 ansible control node the then the vm name is not none but correct one

Any suggestions on this Please ?

cat vm-create-paramater.yml

The Linux distro on the control node is largely irrelevant. It’s the way you define the variables that is the problem.
Add a debug task and check what does variables really are.

What is in that vars file? Typo? Etc etc

Well - /etc/ansible/playbooks/vm-provision/vars/var.yml in my case only has credentials

All variables are passed with -e

So i do not think the issue is with vars in this case

ansible-playbook /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml --extra-vars "vm_name=xxx xxx xxx "

i will try run with -vvvv

Here is the output

ansible-playbook /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml -f 5 --extra-vars “vm_name=vm-name-XXX vm_ip=IPXXXX vcenter_name=DC-vc01.DOMAIN vcenter_folder=DC-C-Infra vcenter_rp=DC-Prod vcenter_dc=DC vcenter_cluster=DC-C-Cluster01 vcenter_template=DC-XXXX-TEMPLATE vm_disk_size=101 vcenter_datastore=DATSTOREXXXX vm_mem_mb_size=16384 vm_cpu_size=1 vm_core_size=1 vcenter_network=VLANXXXX vm_gateway=GWXXXX vcenter_OS=CentOS7 vcenter_Location=DC vcenter_LOB=Infra vcenter_Environment=Test vcenter_Application=test1” -vvvv
ansible-playbook 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3/dist-packages/ansible/plugins/callback/default.py

PLAYBOOK: vm-create-paramater.yml ***************************************************************************************************************************************************
Positional arguments: /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml
verbosity: 4
remote_user: ansible
connection: smart
timeout: 10
become_method: sudo
tags: (‘all’,)
inventory: (‘/etc/ansible/hosts’,)
extra_vars: (‘vm_name=vm-name-XXX vm_ip=IPXXXX vcenter_name=DC-vc01.DOMAIN vcenter_folder=DC-C-Infra vcenter_rp=DC-Prod vcenter_dc=DC vcenter_cluster=DC-C-Cluster01 vcenter_template=DC-XXXX-TEMPLATE vm_disk_size=101 vcenter_datastore=DATSTOREXXXX vm_mem_mb_size=16384 vm_cpu_size=1 vm_core_size=1 vcenter_network=VLANXXXX vm_gateway=GWXXXX vcenter_OS=CentOS7 vcenter_Location=DC vcenter_LOB=Infra vcenter_Environment=Test vcenter_Application=test1’,)
forks: 5
1 plays in /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’

PLAY [localhost] ********************************************************************************************************************************************************************
META: ran handlers
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’

TASK [set_fact] *********************************************************************************************************************************************************************
task path: /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml:9
ok: [localhost] => {
“ansible_facts”: {
“creationdate”: “2021/03/07 22:16”
},
“changed”: false
}
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’

TASK [create vm using template] *****************************************************************************************************************************************************
task path: /etc/ansible/playbooks/vm-provision/vm-create-paramater.yml:10
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: jenkins
<127.0.0.1> EXEC /bin/sh -c ‘echo ~jenkins && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755” && echo ansible-tmp-1615184214.498803-105323394432755=“echo /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755” ) && sleep 0’
Using module file /usr/share/ansible/plugins/modules/vmware_guest.py
<127.0.0.1> PUT /var/lib/jenkins/.ansible/tmp/ansible-local-66186ul4257xf/tmp8ptpb1st TO /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755/AnsiballZ_vmware_guest.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755/ /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755/AnsiballZ_vmware_guest.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3 /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755/AnsiballZ_vmware_guest.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /var/lib/jenkins/.ansible/tmp/ansible-tmp-1615184214.498803-105323394432755/ > /dev/null 2>&1 && sleep 0’
changed: [localhost] => {
“changed”: true,
“instance”: {
“annotation”: “Created On -2021/03/07 22:16”,
“current_snapshot”: null,
“customvalues”: {},
“guest_consolidation_needed”: false,
“guest_question”: null,
“guest_tools_status”: “guestToolsNotRunning”,
“guest_tools_version”: “11269”,
“hw_cluster”: “DC-C-Cluster01”,
“hw_cores_per_socket”: 1,
“hw_datastores”: [
“DATSTOREXXXX”
],
“hw_esxi_host”: “DC-c-esx02.DOMAIN”,
“hw_eth0”: {
“addresstype”: “assigned”,
“ipaddresses”: null,
“label”: “Network adapter 1”,
“macaddress”: “MACXXXX”,
“macaddress_dash”: “MACXXXX”,
“portgroup_key”: null,
“portgroup_portkey”: null,
“summary”: “VLANXXXX”
},
“hw_files”: [
“[DATSTOREXXXX] vm-name-XXX/vm-name-XXX.vmx”,
“[DATSTOREXXXX] vm-name-XXX/vm-name-XXX.nvram”,
“[DATSTOREXXXX] vm-name-XXX/vm-name-XXX.vmsd”,
“[DATSTOREXXXX] vm-name-XXX/vm-name-XXX.vmdk”
],
“hw_folder”: “/DC/vm/DC-C-Infra”,
“hw_guest_full_name”: null,
“hw_guest_ha_state”: false,
“hw_guest_id”: null,
“hw_interfaces”: [
“eth0”
],
“hw_is_template”: false,
“hw_memtotal_mb”: 16384,
“hw_name”: “vm-name-XXX”,
“hw_power_status”: “poweredOn”,
“hw_processor_count”: 1,
“hw_product_uuid”: “422149dc-a95f-50e3-bfa4-9a94a74c38eb”,
“hw_version”: “vmx-15”,
“instance_uuid”: “502171fb-4b14-7161-0e44-aec34593c194”,
“ipv4”: null,
“ipv6”: null,
“module_hw”: true,
“moid”: “vm-34125”,
“snapshots”: ,
“vimref”: “vim.VirtualMachine:vm-34125”,
“vnc”: {}
},
“invocation”: {
“module_args”: {
“annotation”: “Created On -2021/03/07 22:16”,
“cdrom”: ,
“cluster”: “DC-C-Cluster01”,
“convert”: null,
“customization”: {
“autologon”: null,
“autologoncount”: null,
“dns_servers”: [
“xx”,
],
“dns_suffix”: null,
“domain”: “DOMAIN”,
“domainadmin”: null,
“domainadminpassword”: null,
“existing_vm”: null,
“fullname”: null,
“hostname”: null,
“hwclockUTC”: null,
“joindomain”: null,
“joinworkgroup”: null,
“orgname”: null,
“password”: null,
“productid”: null,
“runonce”: null,
“timezone”: null
},
“customization_spec”: null,
“customvalues”: ,
“datacenter”: “DC”,
“datastore”: null,
“delete_from_inventory”: false,
“disk”: [
{
“datastore”: “DATSTOREXXXX”,
“size_gb”: “101”,
“type”: “thin”
}
],
“esxi_hostname”: null,
“folder”: “DC-C-Infra”,
“force”: false,
“guest_id”: null,
“hardware”: {
“boot_firmware”: null,
“cpu_limit”: null,
“cpu_reservation”: null,
“hotadd_cpu”: null,
“hotadd_memory”: null,
“hotremove_cpu”: null,
“max_connections”: null,
“mem_limit”: null,
“mem_reservation”: null,
“memory_mb”: 16384,
“memory_reservation_lock”: null,
“nested_virt”: null,
“num_cpu_cores_per_socket”: 1,
“num_cpus”: 1,
“scsi”: “paravirtual”,
“version”: null,
“virt_based_security”: null
},
“hostname”: “DC-vc01.DOMAIN”,
“is_template”: false,
“linked_clone”: false,
“name”: “vm-name-XXX”,
“name_match”: “first”,
“networks”: [
{
“dns_servers”: [
“XXXX”,
“XXXX”,
“XXXX”
],
“gateway”: “GWXXXX”,
“ip”: “IPXXXX”,
“name”: “VLANXXXX”,
“netmask”: “255.255.255.0”,
“start_connected”: true,
“type”: “static”
}
],
“password”: “VALUE_SPECIFIED_IN_NO_LOG_PARAMETER”,
“port”: 443,
“proxy_host”: null,
“proxy_port”: null,
“resource_pool”: “DC-Prod”,
“snapshot_src”: null,
“state”: “poweredon”,
“state_change_timeout”: 0,
“template”: “DC-XXXX-TEMPLATE”,
“use_instance_uuid”: false,
“username”: “account@DOMAIN”,
“uuid”: null,
“validate_certs”: false,
“vapp_properties”: ,
“wait_for_customization”: false,
“wait_for_customization_timeout”: 3600,
“wait_for_ip_address”: false,
“wait_for_ip_address_timeout”: 300
}
}
}
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’
Read vars_file ‘/etc/ansible/playbooks/vm-provision/vars/vcenter-l2-admin.yml’

And a similar output of a successful attempt on your other control node?

Thanks will share momentarily

None o/p from Ubuntu20x box …

FYI same template… same vcenter … same everything …

2.9.6 is ansible which comes with OS

on other node i did pip3 so version is 2.10 …

None o/p from Ubuntu20x box ..

What do you mean no output?
Why is there no output?

FYI same template... same vcenter .. same everything ..

2.9.6 is ansible which comes with OS

on other node i did pip3 so version is 2.10 ..

Sounds like you have two totally different control nodes, with
different ansible installs, possibly multiple installs, mixed with
Jenkins.
And oh yeah they're also different OS-es.
Since there are so many differences it's will be very hard to tell why
things work on one box and not on the other.

You could start with eliminating the differences between ansible installs.
For instance using a venv on both will help.

Thanks, for now i will keep on hold on this very interesting problem as i have work-around with centos 7