-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws.yml
38 lines (36 loc) · 1.04 KB
/
aws.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
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Launch EC2 instance
ec2:
group: "{{ aws.security_group }}"
instance_type: "{{ aws.instance_type }}"
instance_profile_name: "{{ instance_profile_name }}"
instance_tags:
Name: pcgr "{{ pcgr.release }}"
name: pcgr
spot_price: "{{ aws.spot_price }}"
image: "{{ image_id }}"
region: "{{ aws.region }}"
zone: "{{ aws.zone }}"
user_data: "{{ pcgr_instance_user_data | b64decode }}"
wait: yes
count_tag:
name: pcgr
exact_count: 1
register: ec2
- name: Add new instance to host group
add_host:
hostname: "{{ item.public_dns_name }}"
groupname: launched
with_items: "{{ ec2.instances }}"
- name: Wait for SSH to come up
wait_for:
host: "{{ item.public_dns_name }}"
port: 22
delay: 60
timeout: 320
state: started
with_items: "{{ ec2.instances }}"