-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure_vnet_nsg_2subnet.yml
79 lines (40 loc) · 1.29 KB
/
azure_vnet_nsg_2subnet.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
- name: Create VirtualNetwork
hosts: virtualnetworks
connection: local
gather_facts: no
vars:
rgName: "{{env_id}}-rg-{{resource_group}}"
vnet_name: "{{env_id}}-{{inventory_hostname}}"
tasks:
- name: Create virtual network
azure_rm_virtualnetwork:
resource_group: "{{rgName}}"
name: "{{vnet_name}}"
address_prefixes: "{{vnet_address_prefix}}"
- name: Add FE subnet
azure_rm_subnet:
resource_group: "{{rgName}}"
name: "{{env_id}}-subnet-fe"
address_prefix: "{{vnet_fe_subnet_address_prefix}}"
virtual_network: "{{vnet_name}}"
- name: Add BE subnet
azure_rm_subnet:
resource_group: "{{rgName}}"
name: "{{env_id}}-subnet-be"
address_prefix: "{{vnet_be_subnet_address_prefix}}"
virtual_network: "{{vnet_name}}"
- name: Create Network Security Group - FE - that allows SSH
azure_rm_securitygroup:
resource_group: "{{rgName}}"
name: "{{env_id}}-nsg-fe"
rules:
- name: SSH
protocol: Tcp
destination_port_range: 22
access: Allow
priority: 1001
direction: Inbound
- name: Create Network Security Group - BE
azure_rm_securitygroup:
resource_group: "{{rgName}}"
name: "{{env_id}}-nsg-be"