[root@localhost ~]# cat cvm.yml
---
- name: Create a VM
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Create a virtual machine on given ESXi hostname
vmware_guest:
hostname: 192.168.0.107
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: tempt
# is_template: yes
guest_id: centos64Guest
state: present
# This is hostname of particular ESXi server on which user wants VM to be deployed
esxi_hostname: 192.168.0.106
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
---
- name: Create a VM
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Create a virtual machine on given ESXi hostname
vmware_guest:
hostname: 192.168.0.107
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: tempt
# is_template: yes
guest_id: centos64Guest
state: present
# This is hostname of particular ESXi server on which user wants VM to be deployed
esxi_hostname: 192.168.0.106
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
[root@localhost ~]# ansible-playbook cvm.yml
PLAY [Create a VM] ********************************************************************
TASK [Create a virtual machine on given ESXi hostname] ********************************
changed: [localhost]
PLAY RECAP ****************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Comments
Post a Comment