# vsphere\_client: vm\_extra\_config ignored with template

**URL:** <https://forum.ansible.com/t/vsphere-client-vm-extra-config-ignored-with-template/20424>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [February 2, 2016, 6:46pm UTC](https://forum.ansible.com/t/vsphere-client-vm-extra-config-ignored-with-template/20424 "2016-02-02T18:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Grinwis](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@John\_Grinwis](https://forum.ansible.com/u/John_Grinwis)\
**Post date:** [February 2, 2016, 6:46pm UTC](https://forum.ansible.com/t/vsphere-client-vm-extra-config-ignored-with-template/20424/1 "2016-02-02T18:46:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Grinwis](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@John\_Grinwis](https://forum.ansible.com/u/John_Grinwis)\
**Post date:** [February 2, 2016, 7:36pm UTC](https://forum.ansible.com/t/vsphere-client-vm-extra-config-ignored-with-template/20424/2 "2016-02-02T19:36:20Z")

</div>

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.
