-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcreate_stack.yml
104 lines (96 loc) · 3.34 KB
/
create_stack.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
---
- name: create Azure stack
hosts: localhost
connection: local
gather_facts: false
become: false
vars_files:
- vars/stack.yml
- vars/credentials.yml
vars:
common_tags: &common_tags
'BCM Resource': 'True'
'BCM Bursting': extension
tasks:
- name: Create a resource group
azure.azcollection.azure_rm_resourcegroup:
name: "{{ resource_group_name }}"
location: "{{ location }}"
tags:
<<: *common_tags
- name: Create storage account
azure.azcollection.azure_rm_storageaccount:
resource_group: "{{ resource_group_name }}"
name: "{{ storage_account_name }}"
account_type: Standard_LRS
location: "{{ location }}"
tags:
<<: *common_tags
- name: Create virtual network
azure.azcollection.azure_rm_virtualnetwork:
resource_group: "{{ resource_group_name }}"
name: "{{ virtual_network_name }}"
location: "{{ location }}"
address_prefixes: "{{ virtual_network_address_prefix }}"
tags:
<<: *common_tags
- name: Add subnet
azure.azcollection.azure_rm_subnet:
resource_group: "{{ resource_group_name }}"
name: "{{ subnet_name }}"
address_prefix: "{{ subnet_address_prefix }}"
virtual_network: "{{ virtual_network_name }}"
- name: Create public ip
azure.azcollection.azure_rm_publicipaddress:
resource_group: "{{ resource_group_name }}"
name: "{{ public_ip_address_name }}"
allocation_method: Static
location: "{{ location }}"
tags:
<<: *common_tags
- name: Create security group that allows SSH
azure.azcollection.azure_rm_securitygroup:
resource_group: "{{ resource_group_name }}"
name: "{{ security_group_name }}"
location: "{{ location }}"
rules:
- name: SSH
protocol: Tcp
destination_port_range: 22
access: Allow
priority: 101
direction: Inbound
tags:
<<: *common_tags
- name: Create NIC
azure.azcollection.azure_rm_networkinterface:
resource_group: "{{ resource_group_name }}"
name: "{{ network_interface_name }}"
virtual_network: "{{ virtual_network_name }}"
subnet: "{{ subnet_name }}"
public_ip_name: "{{ public_ip_address_name }}"
security_group: "{{ security_group_name }}"
location: "{{ location }}"
tags:
<<: *common_tags
- name: Create virtual machine
azure.azcollection.azure_rm_virtualmachine:
resource_group: "{{ resource_group_name }}"
name: "{{vm_name}}"
vm_size: Standard_D1
storage_account: "{{ storage_account_name }}"
storage_container: "{{ vm_name }}"
storage_blob: "{{vm_name}}.vhd"
admin_username: "{{ vm_admin_username }}"
admin_password: "{{ vm_admin_password }}"
ssh_password_enabled: false
network_interfaces: "{{ network_interface_name }}"
location: "{{ location }}"
ssh_public_keys:
- path: "/home/{{ vm_admin_username }}/.ssh/authorized_keys"
key_data: "{{ lookup('file', vm_ssh_public_keys) }}"
image: "{{ images[distro] }}"
os_disk_size_gb: 80
tags:
<<: *common_tags
Distro: "{{ distro | mandatory }}"