[root@localhost ~]# cat zinger.yml
---
- hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Create a virtual machine from a template
vmware_guest:
hostname: 192.168.0.107
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm
name: testvm
state: poweredon
template: livekde
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
num_cpu_cores_per_socket: 1
scsi: paravirtual
cdrom:
type: iso
iso_path: "[datastore1] CentOS-7-x86_64-LiveKDE-1810.iso"
[root@localhost ~]# cat vspherefacts.yml
---
- hosts: localhost
tasks:
- name: get all registered vms
vmware_vm_facts:
hostname: 192.168.0.108
username: root
password: vgskiran
validate_certs: False
register: vmfacts
- name: print facts
debug:
msg: "{{vmfacts}}"
"attributes": {},
"cluster": null,
"esxi_hostname": "localhost.localdomain",
"guest_fullname": "CentOS 4/5/6/7 (64-bit)",
"guest_name": "testvm",
"ip_address": "192.168.0.104",
"mac_address": [
"00:50:56:93:ea:6f"
],
"power_state": "poweredOn",
"uuid": "421343a0-2575-113f-8505-06995b57d87f",
"vm_network": {
"00:50:56:93:ea:6f": {
"ipv4": [
"192.168.0.104"
],
"ipv6": [
"fe80::8994:7626:5502:7889"
https://docs.google.com/document/d/e/2PACX-1vQeLfKdru6cq9uNJFZbvc0hXccMd1sk5uiAZJ8QqBqLnhWYG0rzryJ0bD9SPU8G40Oog8zrjZPlufTe/pub
---
- hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Create a virtual machine from a template
vmware_guest:
hostname: 192.168.0.107
username: root
password: vmware
validate_certs: no
datacenter: dc
folder: /dc/vm
name: testvm
state: poweredon
template: livekde
disk:
- size_gb: 10
type: thin
datastore: datastore1
hardware:
memory_mb: 512
num_cpus: 1
num_cpu_cores_per_socket: 1
scsi: paravirtual
cdrom:
type: iso
iso_path: "[datastore1] CentOS-7-x86_64-LiveKDE-1810.iso"
[root@localhost ~]# cat vspherefacts.yml
---
- hosts: localhost
tasks:
- name: get all registered vms
vmware_vm_facts:
hostname: 192.168.0.108
username: root
password: vgskiran
validate_certs: False
register: vmfacts
- name: print facts
debug:
msg: "{{vmfacts}}"
[root@localhost ~]# vi vspherefacts.yml
[root@localhost ~]# ansible-playbook vspherefacts.yml
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [get all registered vms] **************************************************
ok: [localhost]
TASK [print facts] *************************************************************
"attributes": {},
"cluster": null,
"esxi_hostname": "localhost.localdomain",
"guest_fullname": "CentOS 4/5/6/7 (64-bit)",
"guest_name": "testvm",
"ip_address": "192.168.0.104",
"mac_address": [
"00:50:56:93:ea:6f"
],
"power_state": "poweredOn",
"uuid": "421343a0-2575-113f-8505-06995b57d87f",
"vm_network": {
"00:50:56:93:ea:6f": {
"ipv4": [
"192.168.0.104"
],
"ipv6": [
"fe80::8994:7626:5502:7889"
https://docs.google.com/document/d/e/2PACX-1vQeLfKdru6cq9uNJFZbvc0hXccMd1sk5uiAZJ8QqBqLnhWYG0rzryJ0bD9SPU8G40Oog8zrjZPlufTe/pub
Comments
Post a Comment