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

On Wednesday, April 26, 2017 at 2:09:55 PM UTC+1, Lemar wrote:
>
> 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/91e1323a-b093-4bc6-83f7-8b08a98c6a31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to