(Not sure if my last post went through, please delete this one if so)

Hi All!

I'm trying to deploy a VM using the vmware_guest module, and noticed that 
I'm unable to add a network device unless I additionally specify a MAC 
address. From the docs, it looks like adding a mac entry is optional - so 
I'm sure I'm missing something here!

(I know MAC addresses can be generated from Ansible, but ideally, I'd like 
to leave that job to ESXi)

Any help is appreciated!

Version:
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 
      default: "root" 
    - 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_host }}" 
        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 
    - name: Gather VM facts 

Output of playbook (-vvv): 
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": "192.168.1.254", 
            "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'." 
}


-- 
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/bff61513-2ce7-46fa-9363-858963f7761a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to