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)]---
- 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'."
} 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