-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure.yml
More file actions
43 lines (38 loc) · 1.45 KB
/
azure.yml
File metadata and controls
43 lines (38 loc) · 1.45 KB
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
- name: Create a sandbox instance
hosts: localhost
gather_facts: False
connection: local
tags: provisioning
vars:
ssh_cert_path: ~/.azure/azure.pem
server_name: azure-test-vm
user_name: ubuntu
image: 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-saucy-13_10-amd64-server-20140618-en-us-30GB'
tasks:
# Provision virtual machine example
- name: 'start azure vm'
local_action: azure name={{ server_name }} role_size='ExtraSmall' image={{image}} location='West Europe' user={{ user_name }} ssh_cert_path={{ ssh_cert_path }} storage_account=matlockxstorage
register: azure
- name: Add new instance to host group
local_action: add_host hostname={{ server_name }} groupname=launched ansible_ssh_host={{item}} ansible_ssh_private_key_file={{ ssh_cert_path }} ansible_ssh_user={{ user_name }}
with_items: azure.public_dns_name
- name: Wait for SSH to come up
local_action: wait_for host={{ item }} port=22 delay=60 timeout=320 state=started
with_items: azure.public_dns_name
- name: Configure instance(s)
hosts: launched
sudo: True
gather_facts: True
tasks:
- name: install nginx
apt: name=nginx state=latest update_cache=yes
- name: Terminate instances
hosts: launched
connection: local
tags: delete
vars:
server_name: azure-test-vm
tasks:
# Terminate virtual machine example
- name: 'delete vm'
local_action: azure name={{ server_name }} state=absent