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: *
---
- hosts: test-vms
  gather_facts: false
  connection: local
  vars_prompt:
    - name: "esxi_user"
      prompt: "Enter ESXi username"
      private: no
    - name: "esxi_pass"
      prompt: "Enter ESXi password"
      private: yes
  vars:
    datacenter: 'ha-datacenter'
    notes: 'Created by Ansible'
  tasks:
    - name: "Deploy VM"
      vmware_guest:
        name: "{{ inventory_hostname }}"
        validate_certs: False
        hostname: "{{ esxi_hostname }}"
        username: "{{ esxi_user }}"
        password: "{{ esxi_pass }}"
        state: present
        guest_id: "{{ osid }}"
        disk:
        - size_gb: "{{ disk_size }}"
          type: thin
          datastore: "{{ datastore }}"
        hardware:
          memory_mb: "{{ memory }}"
          num_cpus: "{{ cpucount }}"
        networks:
        - name: VM Network
      delegate_to: localhost

*results:*
fatal: [test-vm01 -> localhost]: FAILED! => {
    "changed": true,
    "failed": true,
    "invocation": {
        "module_args": {
            "annotation": null,
            "cluster": null,
            "customization": {},
            "customvalues": [],
            "datacenter": "ha-datacenter",
            "disk": [
                {
                    "datastore": "datastore1",
                    "size_gb": 10,
                    "type": "thin"
                }
            ],
            "esxi_hostname": null,
            "folder": "/vm",
            "force": false,
            "guest_id": "centos64Guest",
            "hardware": {
                "memory_mb": 512,
                "num_cpus": 1
            },
            "hostname": "1.1.1.1",
            "is_template": false,
            "name": "test-vm01",
            "name_match": "first",
            "networks": [
                {
                    "name": "VM Network"
                }
            ],
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "resource_pool": null,
            "state": "present",
            "template_src": null,
            "username": "root",
            "uuid": null,
            "validate_certs": false,
            "wait_for_ip_address": false
        }
    },
    "msg": "Invalid configuration for device '2'."
}

I'm sure I'm missing something obvious, so any help is appreciated!



 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2467ee41-7ad4-4933-b3a6-e7f6e3377d63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to