-
Notifications
You must be signed in to change notification settings - Fork 1
/
azuresetup.yml
178 lines (167 loc) · 6.51 KB
/
azuresetup.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
- name: Setup azure demo environment
hosts: localhost
gather_facts: false
become: true
tasks:
- name: Add project
ansible.controller.project:
name: "Azure Demos Project"
description: "This is from github.com/ansible-cloud"
organization: "Default"
state: present
scm_type: git
scm_url: https://github.com/ansible-cloud/azure-demos
default_environment: "ee-cloud-services"
- name: Create the Azure related job templates
ansible.controller.job_template:
name: "{{ item.name }}"
job_type: "run"
organization: "Default"
inventory: "Demo Inventory"
project: "Azure Demos Project"
extra_vars:
resource_group_name: "azure-demo"
region: "eastus"
vnet_cidr: "10.0.0.0/16"
subnet_cidr: "10.0.1.0/24"
vnet_name: "demo_vnet"
subnet_name: "demo_subnet"
network_sec_group_name: "demo_sec_group"
win_vm_name: "WIN-ansible"
win_vm_size: "Standard_DS1_v2"
win_vm_sku: "2022-Datacenter"
win_public_ip_name: "win_demo_ip"
win_nic_name: "win_demo_nic"
win_admin_user: "azureuser"
win_admin_password: "ansible123!"
playbook: "project/{{ item.playbook }}"
credentials:
- "Microsoft Azure Resource Manager"
state: "present"
with_items:
- { playbook: 'create_resource_group.yml', name: 'Create Azure Resource Group' }
- { playbook: 'create_windows_vm_demo.yml', name: 'Create Windows Server 2022 VM' }
- { playbook: 'destroy_resource_group.yml', name: 'Destroy Azure Resource Group' }
- name: Create the workflow nodes job templates
ansible.controller.job_template:
name: "{{ item.name }}"
job_type: "run"
organization: "Default"
inventory: "Demo Inventory"
project: "Azure Demos Project"
extra_vars:
resource_group_name: "azure-demo"
region: "eastus"
vnet_cidr: "10.0.0.0/16"
subnet_cidr: "10.0.1.0/24"
vnet_name: "demo_vnet"
subnet_name: "demo_subnet"
network_sec_group_name: "demo_sec_group"
win_vm_name: "WIN-ansible"
win_vm_size: "Standard_DS1_v2"
win_vm_sku: "2022-Datacenter"
win_public_ip_name: "win_demo_ip"
win_nic_name: "win_demo_nic"
win_admin_user: "azureuser"
win_admin_password: "ansible123!"
playbook: "workflow/{{ item.playbook }}"
credentials:
- "Microsoft Azure Resource Manager"
state: "present"
with_items:
- { playbook: '01-create_resource_group.yml', name: 'WF-01-Create Resource Group' }
- { playbook: '02-create_virtual_network.yml', name: 'WF-02-Create Virtual Network' }
- { playbook: '03-add_subnet.yml', name: 'WF-03-Add Subnet' }
- { playbook: '04-create_public_ip_address.yml', name: 'WF-04-Create Public IP Address' }
- { playbook: '05-create_network_security_group.yml', name: 'WF-05-Create Network Security Group' }
- { playbook: '06-create_virtual_network_interface_card.yml', name: 'WF-06-Create Virtual Network Interface Card' }
- { playbook: '07-create_windows_2022_vm.yml', name: 'WF-07-Create Windows 2022 Virtual Machine' }
- name: Create the workflow template and its schema
ansible.controller.workflow_job_template:
name: "WF-network-infra-deploy-config-windows2022"
organization: "Default"
schema:
- identifier: "WF-01-Create Resource Group"
unified_job_template:
name: "WF-01-Create Resource Group"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-02-Create Virtual Network"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-02-Create Virtual Network"
unified_job_template:
name: "WF-02-Create Virtual Network"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-03-Add Subnet"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-03-Add Subnet"
unified_job_template:
name: "WF-03-Add Subnet"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-04-Create Public IP Address"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-04-Create Public IP Address"
unified_job_template:
name: "WF-04-Create Public IP Address"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-05-Create Network Security Group"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-05-Create Network Security Group"
unified_job_template:
name: "WF-05-Create Network Security Group"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-06-Create Virtual Network Interface Card"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-06-Create Virtual Network Interface Card"
unified_job_template:
name: "WF-06-Create Virtual Network Interface Card"
organization:
name: "Default"
type: job_template
related:
success_nodes:
- identifier: "WF-07-Create Windows 2022 Virtual Machine"
failure_nodes: []
always_nodes: []
credentials: []
- identifier: "WF-07-Create Windows 2022 Virtual Machine"
unified_job_template:
name: "WF-07-Create Windows 2022 Virtual Machine"
organization:
name: "Default"
type: job_template
related:
success_nodes: []
failure_nodes: []
always_nodes: []
credentials: []