Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (36 sloc) 1.04 KB
---
- 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 }}"