vsphere_client: vm_extra_config ignored with template

120 views
Skip to first unread message

John Grinwis

unread,
Feb 2, 2016, 1:49:42 PM2/2/16
to Ansible Project
Hi,

we're doing some test with deploying a Juniper vSRX on our VMware environment using Ansible 2.1.0
This vSRX can configure itself if you add machine.id with some parameters to the .vmx file.
But if we try to use the following vm_extra_config: in our playbook:

       vm_extra_config:
          folder: vSRX
          machine.id: hostname=initial-vsrx.test.nl
          annotation: testtesttest
          notes: test

It's cloning the VM template, placing the VM in the correct folder but no changes to the .vmx file.
So machine.id is not added to the .vmx file but also the notes are not being updated.

Is this expected behaviour? 
According to the docs: vm_extra_config: A key, value pair of any extra values you want set or changed in the vmx file of the VM

Regards,
John

John Grinwis

unread,
Feb 2, 2016, 2:36:20 PM2/2/16
to Ansible Project
Hmm, looks like vsphere_guest.py is only checking folder info from vm_extra_config when cloning a template:

try:
if not vmTarget:
cloneArgs = dict(resourcepool=rpmor, power_on=power_on_after_clone)
if snapshot_to_clone is not None:
#check if snapshot_to_clone is specified, Create a Linked Clone instead of a full clone.
cloneArgs["linked"] = True
cloneArgs["snapshot"] = snapshot_to_clone
if vm_extra_config.get("folder") is not None:
# if a folder is specified, clone the VM into it
cloneArgs["folder"] = vm_extra_config.get("folder")
vmTemplate.clone(guest, **cloneArgs)

Need to look into pyvmomi to check if we can add some fields to specify my system.id in .vmx.

Op dinsdag 2 februari 2016 19:49:42 UTC+1 schreef John Grinwis:
Reply all
Reply to author
Forward
0 new messages