ansible Create a virtual machine on given ESXi hostname will all powerstates vcenter
[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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: test
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 4
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]#
---
- 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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: test
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 4
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]#
[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
https://docs.google.com/document/d/e/2PACX-1vRHwXlZsER9mtUAoQfwzNBgvO-QbFoEw2ksBnYEY8Sf3429pPu1svPeZepckYBx7hKt5rCXM4sSgTYD/pub
1cpu.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 1cpu
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]# ansible-playbook 1cpu.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
https://docs.google.com/document/d/e/2PACX-1vRHmuA9DOJ0zRFc7uibAfPPYzAeyNVREdRBaZOzIlu6wHiFMFEd5v-hKEaukj35ftMOMhSxB0jQS4eA/pub
2cpu.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 2cpu
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 2
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]# ansible-playbook 2cpu.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
https://docs.google.com/document/d/e/2PACX-1vRHwXlZsER9mtUAoQfwzNBgvO-QbFoEw2ksBnYEY8Sf3429pPu1svPeZepckYBx7hKt5rCXM4sSgTYD/pub
2cpupoweroff.yml
[root@localhost ~]# ansible-playbook 2cpupoweroff.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
[root@localhost ~]#
1cpu.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 1cpu
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]# ansible-playbook 1cpu.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
https://docs.google.com/document/d/e/2PACX-1vRHmuA9DOJ0zRFc7uibAfPPYzAeyNVREdRBaZOzIlu6wHiFMFEd5v-hKEaukj35ftMOMhSxB0jQS4eA/pub
2cpu.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 2cpu
state: poweredon
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be de ployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 2
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]# ansible-playbook 2cpu.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
https://docs.google.com/document/d/e/2PACX-1vRHwXlZsER9mtUAoQfwzNBgvO-QbFoEw2ksBnYEY8Sf3429pPu1svPeZepckYBx7hKt5rCXM4sSgTYD/pub
2cpupoweroff.yml
[root@localhost ~]# ansible-playbook 2cpupoweroff.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
[root@localhost ~]#
https://docs.google.com/document/d/e/2PACX-1vT-FcfNUnnmoRDHhEpRqT1WSAUDzbkwZFcj32O_t15vt3Ugd3BHMx1RsUo0taRzQTke2n8_c-VnNbI_/pub
1cpupoweroff.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 1cpu
state: poweredoff
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be deployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
[root@localhost ~]# ansible-playbook 1cpupoweroff.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
https://docs.google.com/document/d/e/2PACX-1vQr-D0zWh-D4_bPBVQBtVy4RSmNngqKEWdyAlD2ZbQak2QzLZjqMV88yqjQv0-_f3d1UzSC5wLAhhYM/pub
1cpupoweroff.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.45.151
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm/
name: 1cpu
state: poweredoff
guest_id: centos64Guest
# This is hostname of particular ESXi server on which user wants VM to be deployed
esxi_hostname: 192.168.45.154
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
scsi: paravirtual
# networks:
# - name: VM Network
# mac: aa:bb:dd:aa:00:14
# ip: 10.10.10.100
# netmask: 255.255.255.0
# device_type: vmxnet3
# wait_for_ip_address: yes
# delegate_to: localhost
# register: deploy_vm
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
https://docs.google.com/document/d/e/2PACX-1vQr-D0zWh-D4_bPBVQBtVy4RSmNngqKEWdyAlD2ZbQak2QzLZjqMV88yqjQv0-_f3d1UzSC5wLAhhYM/pub
Comments
Post a Comment