Hello all,
I’ve put together a little playbook to help our IT department deploy VMs using the vsphere_guest module.
The playbook works great - so long as we’re on a Linux system (running Ansible 1.8), but fails miserably when we try to run it on our MacBooks running OSX 10.10.3, Ansible 1.9.1, and pysphere 0.1.7.
Now that I’m typing this, I suppose the issue could have something to do with the Ansible version mis-match - but that’s something I can test when I get back to the office in the morning.
Anyway, the error I get running the playbook on a Mac is:
failed: [127.0.0.1] => {“failed”: true}
msg: parameters are required together: [‘from_template’, ‘resource_pool’, ‘template_src’]
FATAL: all hosts have already failed – aborting
I’ve tried running it as verbosely as possible looking for clues, but I’m lost … so the playbook is below (I welcome any suggestions for improvement), and thanks in advance!
Playbook:
- hosts: 127.0.0.1
connection: local
sudo: false
gather_facts: false
serial: 1
vars_prompt:
-
name: “vcenter_user”
prompt: “Enter your vcenter username”
private: no -
name: “user_pass”
prompt: “Enter your vcenter password”
private: yes -
name: “vm_hostname”
prompt: “Enter the hostname for this VM”
private: no -
name: “vm_memory”
prompt: “Memory in MB”
private: no
default: “4048” -
name: “vm_cores”
prompt: “Number of Cores”
private: no
default: “2”
tasks:
- vsphere_guest:
vcenter_hostname: vcenter01.XXXX
username: “{{ vcenter_user }}”
password: “{{ user_pass }}”
guest: “{{ vm_hostname }}”
cluster: “CYC”
resource_pool: “/Resources/XXXX-Default”
state: powered_off
vm_hw_version: “vmx-08”
vm_extra_config:
vcpu.hotadd: no
mem.hotadd: no
vm_disk:
disk1:
size_gb: 60
type: thick
datastore: “DataStore03”
vm_nic:
nic1:
type: e1000
network: “XXXXX”
network_type: standard
vm_hardware:
memory_mb: “{{ vm_memory }}”
num_cpus: “{{ vm_cores }}”
osid: otherLinux64Guest
scsi: lsi
esxi:
datacenter: XXX
hostname: XXXXX