Lemar
(Lemar)
April 25, 2017, 10:55pm
1
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 ), 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:
`
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
Lemar
(Lemar)
April 26, 2017, 7:54pm
3
No luck there - changing the indentation yields the same error.
Lemar
(Lemar)
April 29, 2017, 12:56am
4
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