-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmware-instances.yaml
65 lines (61 loc) · 1.99 KB
/
vmware-instances.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- name: Provision VMware Instances
hosts: localhost
tasks:
- name: Create VMware Instances
include_role:
name: vmware-instances
- name: Update pfSense DHCP Reservations
include_role:
name: pfsense-dhcp-reserved-ip
vars:
pd_mac: "{{ item.mac }}"
pd_cid: "{{ item.name }}"
pd_ipaddr: "{{ item.ip }}"
pd_hostname: "{{ item.name }}"
pd_dns1: "{{ item.dns }}"
pd_gateway: "{{ item.gateway }}"
loop: "{{ host_mac_list }}"
- name: Generate IPA Session Cookie
uri:
url: "https://{{ ipa_hostname }}/ipa/session/login_password"
validate_certs: no
method: POST
status_code: 200
headers:
Content-Type: "application/x-www-form-urlencoded"
Accept: "text/plain"
Referer: "https://{{ ipa_hostname }}/ipa"
body: "user={{ ipa_username }}&password={{ ipa_password }}"
register: ipa_session
- name: Create A/PTR Records
uri:
url: "https://{{ ipa_hostname }}/ipa/session/json"
validate_certs: no
method: POST
status_code: 200
headers:
Cookie: "{{ ipa_session.set_cookie }}"
Accept: "application/json"
Referer: "https://{{ ipa_hostname }}/ipa"
body:
method: dnsrecord_add
params:
- - "{{ base_domain }}."
- "{{ item }}"
- a_part_ip_address: "{{ hostvars[item].ip }}"
a_extra_create_reverse: true
body_format: json
with_items:
- "{{ groups[provision_group] }}"
- name: Start VMware Instances
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
cluster: "{{ vcenter_cluster }}"
datacenter: "{{ vcenter_datacenter }}"
name: "{{ item }}.{{ base_domain }}"
state: poweredon
with_items:
- "{{ groups[provision_group] }}"