blob: 33556082a56fb2e89c723fdf26a07f492650125e (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
- name: deploy active directory range on proxmox
hosts: localhost
gather_facts: no
tasks:
- name: "deploy {{ main_dc01_hostname }}.{{ main_domain_name }} vm on {{ proxmox_hostname }}"
include_role:
name: proxmox_vm
vars:
os_type : "windows"
template : "{{ windows_server_template_name }}"
id : "{{ windows_server_template_id }}"
vm : "{{ main_dc01_hostname }}.{{ main_domain_name }}"
newid : "{{ main_dc01_vmid }}"
vmid : "{{ main_dc01_vmid }}"
ip : "{{ main_dc01_ip_address }}"
gateway : "{{ network_gateway }}"
dns : "8.8.8.8"
hostname : "{{ main_dc01_hostname }}"
domain : "{{ main_domain_name }}"
fqdn : "{{ main_dc01_hostname }}.{{ main_domain_name }}"
- name: "add {{ main_dc01_hostname }}.{{ main_domain_name }} to in-memory inventory"
add_host:
name : "{{ main_dc01_hostname }}.{{ main_domain_name }}"
ansible_host : "{{ main_dc01_ip_address }}"
ansible_connection : "{{ win_connector }}"
ansible_user : "{{ default_win_username }}"
ansible_password : "{{ default_win_password }}"
ansible_port : "{{ win_port }}"
ansible_winrm_transport : basic
ansible_winrm_server_cert_validation: ignore
changed_when: false
- name: "deploy {{ main_linux_srv01_hostname }}.{{ main_domain_name }} vm on {{ proxmox_hostname }}"
include_role:
name: proxmox_vm
vars:
os_type : "linux"
template : "{{ linux_server_template_name }}"
id : "{{ linux_server_template_id }}"
vm : "{{ main_linux_srv01_hostname }}.{{ main_domain_name }}"
newid : "{{ main_linux_srv01_vmid }}"
vmid : "{{ main_linux_srv01_vmid }}"
ip : "{{ main_linux_srv01_ip_address }}"
gateway : "{{ network_gateway }}"
dns : "{{ main_dc01_ip_address }}"
hostname : "{{ main_linux_srv01_hostname }}"
domain : "{{ main_domain_name }}"
fqdn : "{{ main_linux_srv01_hostname }}.{{ main_domain_name }}"
- name: "add {{ main_linux_srv01_hostname }}.{{ main_domain_name }} to in-memory inventory"
add_host:
name : "{{ main_linux_srv01_hostname }}.{{ main_domain_name }}"
ansible_host : "{{ main_linux_srv01_ip_address }}"
ansible_connection : "{{ linux_connector }}"
ansible_user : "{{ default_linux_username }}"
ansible_password : "{{ default_linux_password }}"
ansible_port : "{{ linux_port }}"
ansible_host_key_checking : false
changed_when: false
- name: "deploy {{ main_adcs01_hostname }}.{{ main_domain_name }} vm on {{ proxmox_hostname }}"
include_role:
name: proxmox_vm
vars:
os_type : "windows"
template : "{{ windows_server_template_name }}"
id : "{{ windows_server_template_id }}"
vm : "{{ main_adcs01_hostname }}.{{ main_domain_name }}"
newid : "{{ main_adcs01_vmid }}"
vmid : "{{ main_adcs01_vmid }}"
ip : "{{ main_adcs01_ip_address }}"
gateway : "{{ network_gateway }}"
dns : "{{ main_dc01_ip_address }}"
hostname : "{{ main_adcs01_hostname }}"
domain : "{{ main_domain_name }}"
fqdn : "{{ main_adcs01_hostname }}.{{ main_domain_name }}"
- name: "add {{ main_adcs01_hostname }}.{{ main_domain_name }} to in-memory inventory"
add_host:
name : "{{ main_adcs01_hostname }}.{{ main_domain_name }}"
ansible_host : "{{ main_adcs01_ip_address }}"
ansible_connection : "{{ win_connector }}"
ansible_user : "{{ default_win_username }}"
ansible_password : "{{ default_win_password }}"
ansible_port : "{{ win_port }}"
ansible_winrm_transport : basic
ansible_winrm_server_cert_validation: ignore
changed_when: false
- name: configure hosts
hosts: all
gather_facts: no
tasks:
- name: "configure {{ main_dc01_hostname }}.{{ main_domain_name }}"
include_role:
name: dc01
when: inventory_hostname == main_dc01_hostname + '.' + main_domain_name
- name: "configure {{ main_linux_srv01_hostname }}.{{ main_domain_name }}"
include_role:
name: srv01
when: inventory_hostname == main_linux_srv01_hostname + '.' + main_domain_name
- name: "configure {{ main_adcs01_hostname }}.{{ main_domain_name }}"
include_role:
name: adcs01
when: inventory_hostname == main_adcs01_hostname + '.' + main_domain_name
|