Skip to content

Instantly share code, notes, and snippets.

@rob-b
Created September 17, 2013 12:10
Show Gist options
  • Save rob-b/6593507 to your computer and use it in GitHub Desktop.
Save rob-b/6593507 to your computer and use it in GitHub Desktop.
- name: ec2 instance
hosts: localhost
connection: local
# user: root
gather_facts: false
vars:
keypair: lostproperty
instance_type: m1.small
security_group: default
image: ami-08ee0b7f
count: 1
region: eu-west-1
tasks:
- name: Launch instance
local_action: ec2 keypair=$keypair group=$security_group instance_type=$instance_type image=$image count=$count wait=true region=$region instance_tags='{"Name":"graduates iii"}'
register: ec2
# - name: Itemised host group addition
# local_action: add_host hostname=${item.public_ip} groupname=launched
# with_items: ${ec2.instances}
- name: wait for ssh to come up
local_action: wait_for host={{item.public_dns_name}} port=22 timeout=320 state=started
with_items: ec2.instances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment