Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Wed Jul 26 05:35:58 ansible@ansible-2:~/vmware$ cat vmcreate.yml
- ---
- - hosts: localhost
- connection: local
- gather_facts: no
- vars_prompt:
- - name: myuser
- prompt: Enter the UserName
- private: no
- - name: mypass
- prompt: Enter the Password
- - name: vc_name
- prompt: Enter the vCenter/ESXi HostName
- private: no
- - name: guest_name
- prompt: Enter the Guest VM Name
- private: no
- remote_user: root
- tasks:
- - name: Create a VM
- delegate_to: localhost
- vsphere_guest:
- # vcenter_hostname: '{{vc_name}}'
- esxi:
- datacenter: ha-datacenter
- hostname: '{{vc_name}}'
- username: '{{myuser}}'
- password: '{{mypass}}'
- validate_certs: no
- guest: '{{guest_name}}'
- state: powered_on
- vm_extra_config:
- vcpu.hotadd: yes
- mem.hotadd: yes
- notes: This is a test VM created using Ansible
- # folder: [datastore1 (4)]
- vm_disk:
- disk1:
- size_gb: 100
- type: thin
- datastore: datastore1(4)
- vm_nic:
- nic1:
- type: vmxnet3
- network: VM Network
- network_type: standard
- vm_hardware:
- memory_mb: 2048
- num_cpus: 2
- osid: rhel6_64Guest
- scsi: paravirtual
- vm_cdrom:
- type: "iso"
- iso_path: "iso/apollo-adopter-esx-03-03-17-v1.iso"
- Wed Jul 26 05:43:34 ansible@ansible-2:~/vmware$
Add Comment
Please, Sign In to add comment