-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-cfme-ansible-create-entire-environment.yml
89 lines (82 loc) · 3.55 KB
/
azure-cfme-ansible-create-entire-environment.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
################################################################################################
# Creating an Entire Environment in Microsoft Azure #
# #
# By Robert J. Calva - Red Hat LATAM - 2016 #
# #
# NOTE: just set the location, Resoruce Group, Storage Account, Virtual Network, Public IP, #
# Security Group and more variables as you wish! #
# #
# IMPORTANT: for further information about Microsoft Azure, please take a look at this link: #
# https://docs.microsoft.com/en-us/azure/ #
# #
# Enjoy! #
################################################################################################
- name: Create an entire Environment in Azure
hosts: all
connection: local
tasks:
- name: Create a resource group
azure_rm_resourcegroup:
name: "{{ resourcegroup }}"
location: "{{ location }}"
state: present
- name: Create storage account
azure_rm_storageaccount:
resource_group: "{{ resourcegroup }}"
name: "{{ storageaccount }}"
account_type: Standard_LRS
- name: Create virtual network
azure_rm_virtualnetwork:
resource_group: "{{ resourcegroup }}"
name: "{{ virtualnetwork }}"
address_prefixes: "{{ address_prefix }}"
- name: Add subnet
azure_rm_subnet:
resource_group: "{{ resourcegroup }}"
name: "{{ subnet }}"
address_prefix: "{{ subnet_prefix }}"
virtual_network: "{{ virtualnetwork }}"
- name: Create public ip
azure_rm_publicipaddress:
resource_group: "{{ resourcegroup }}"
allocation_method: Static
name: "{{ publicip }}"
- name: Create security group that allows SSH
azure_rm_securitygroup:
resource_group: "{{ resourcegroup }}"
name: "{{ secgroup }}"
rules:
- name: SSH
protocol: Tcp
destination_port_range: 22
access: Allow
priority: 101
direction: Inbound
- name: Create NIC
azure_rm_networkinterface:
resource_group: "{{ resourcegroup }}"
name: "{{ nicname }}"
virtual_network: "{{ virtualnetwork }}"
subnet: "{{ subnet }}"
public_ip_name: "{{ publicip }}"
security_group: "{{ secgroup }}"
- name: Create virtual machine
azure_rm_virtualmachine:
resource_group: "{{ resourcegroup }}"
name: "{{ vmname }}"
vm_size: "{{ vmsize }}"
storage_account: "{{ storageaccount }}"
storage_container: "{{ vmname }}"
storage_blob: "{{ vmname }}.vhd"
admin_username: "{{ username }}"
# admin_password: "{{ password }}"
ssh_password_enabled: False
ssh_public_keys:
- path: /home/{{ username }}/.ssh/authorized_keys
key_data: "{{ sshkeys }}"
network_interfaces: "{{ nicname }}"
image:
offer: CentOS
publisher: OpenLogic
sku: '7.1'
version: latest