-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm.yml
47 lines (45 loc) · 1.23 KB
/
vm.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
- name: Create VM
hosts: localhost
connection: local
vars_files:
- vars.yml
tasks:
- name: Create resource group
azure_rm_resourcegroup:
name: "{{ group_name }}"
location: southcentralus
- name: Create virtual network
azure_rm_virtualnetwork:
resource_group: "{{ group_name }}"
name: "{{vnet}}"
address_prefixes: "10.0.0.0/16"
- name: Add subnet
azure_rm_subnet:
resource_group: "{{ group_name }}"
name: "{{subnet_name}}"
address_prefix: "10.0.1.0/24"
virtual_network: "{{vnet}}"
- name: Create Network Security Group that allows SSH
azure_rm_securitygroup:
resource_group: "{{ group_name }}"
name: "{{ nsg_name }}"
rules:
- name: SSH
protocol: Tcp
destination_port_range: 22
access: Allow
priority: 1001
direction: Inbound
- name: HTTP
protocol: Tcp
destination_port_range: 80
access: Allow
priority: 1002
direction: Inbound
- include_tasks: vm_details.yml
loop:
- { name: 'one', tag: 'haproxy' }
- { name: 'two', tag: 'apache' }
- { name: 'three', tag: 'apache' }
loop_control:
loop_var: vm