# vmware\_guest: How to create a VM with a NIC, without specifying a MAC address on creation

**URL:** <https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316>\
**Category:** Ansible Project\
**Created:** [April 25, 2017, 10:55pm UTC](https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316 "2017-04-25T22:55:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lemar](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@Lemar](https://forum.ansible.com/u/Lemar)\
**Post date:** [April 25, 2017, 10:55pm UTC](https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316/1 "2017-04-25T22:55:55Z")

</div>

Hi All!

I’m running Ansible v2.3, and want to know if it’s possible to create virtual machines with NIC’s, without specifying a MAC address.

While it’s listed as optional in the docs ([http://docs.ansible.com/ansible/vmware\_guest\_module.html](http://docs.ansible.com/ansible/vmware_guest_module.html)), the playbook fails unless a mac entry is created.

**Version Info:**

`

ansible 2.3.0.0

config file = /etc/ansible/ansible.cfg

configured module search path = Default w/o overrides

python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]  
`

**Example playbook:**

`

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [April 26, 2017, 4:40pm UTC](https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316/2 "2017-04-26T16:40:13Z")

</div>

Bit of a wild guess this, but just wondering if the issue is indentation?

`disk:`  
`- size_gb: "{{ disk_size }}"`  
`type: thin`  
`datastore: "{{ datastore }}"`  
`hardware:`  
`memory_mb: "{{ memory }}"`  
`num_cpus: "{{ cpucount }}"`  
`networks:`  
`- name: VM Network`

`might need to be`

`disk:`  
`- size_gb: "{{ disk_size }}"`  
`type: thin`  
`datastore: "{{ datastore }}"`  
`hardware:`  
`memory_mb: "{{ memory }}"`  
`num_cpus: "{{ cpucount }}"`  
`networks:`  
`- name: VM Network`

---

<div class="post-metadata">

**Author:** ![Lemar](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@Lemar](https://forum.ansible.com/u/Lemar)\
**Post date:** [April 26, 2017, 7:54pm UTC](https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316/3 "2017-04-26T19:54:03Z")

</div>

No luck there - changing the indentation yields the same error.

---

<div class="post-metadata">

**Author:** ![Lemar](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@Lemar](https://forum.ansible.com/u/Lemar)\
**Post date:** [April 29, 2017, 12:56am UTC](https://forum.ansible.com/t/vmware-guest-how-to-create-a-vm-with-a-nic-without-specifying-a-mac-address-on-creation/24316/4 "2017-04-29T00:56:02Z")

</div>

Found the issue!

The create\_nic function within the vmware\_guest module sets the nic’s address type as ‘assigned’, which requires you to supply a MAC address.  
The problem is, it will do this whether you supply a MAC address or not.

I’ve submitted a patch to fix this: [https://github.com/ansible/ansible/pull/24138](https://github.com/ansible/ansible/pull/24138)
