-
Notifications
You must be signed in to change notification settings - Fork 2
/
vsphere_inventory.yml
48 lines (48 loc) · 1.48 KB
/
vsphere_inventory.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
- hosts: localhost
connection: local
gather_facts: True
tasks:
# - name: "guest_info collection for {{ vm_name }}"
# vmware_guest_info:
# hostname: '{{ vcenter_host }}'
# username: '{{ vcenter_user }}'
# password: '{{ vcenter_password }}'
# validate_certs: False
# datacenter: "{{ dc }}"
# name: "{{ vm_name }}"
# schema: "vsphere"
# delegate_to: localhost
# register: guest_info
# - debug:
# var: guest_info
# - name: "vm_info collection for {{ vm_name }}"
# vmware_vm_info:
# hostname: '{{ vcenter_host }}'
# username: '{{ vcenter_user }}'
# password: '{{ vcenter_password }}'
# validate_certs: False
# vm_type: vm
# name: "{{ vm_name }}"
# delegate_to: localhost
# register: vm_info
# - debug:
# var: vm_info
- name: "Create VM from Server Template"
vmware_guest:
hostname: '{{ vcenter_host }}'
username: '{{ vcenter_user }}'
password: '{{ vcenter_password }}'
validate_certs: False
name: "{{ id }}_jumpbox"
template: "{{ server_template }}"
datacenter: "{{ dc }}"
folder: "{{ id }}"
networks:
- name: "{{ mgmt_network }}"
- name: "{{ server_network }}"
state: '{{ state | default("poweredon")}}'
wait_for_ip_address: yes
delegate_to: localhost
register: jumpbox
- debug:
var: jumpbox.instance