Commit 3756b36d authored by ber's avatar ber
Browse files

async prov

parent 375481a2
---
#Provision some instances:
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- group_vars/all
tasks:
- name: Launch webserver instances
ec2: >
access_key="{{ ec2_access_key }}"
secret_key="{{ ec2_secret_key }}"
keypair="{{ ec2_keypair }}"
group="{{ ec2_security_group }}"
type="{{ ec2_instance_type }}"
image="{{ ec2_image }}"
region="{{ ec2_region }}"
instance_tags="{'ansible_group':'{{ ec2_tag_webservers }}', 'type':'{{ ec2_instance_type }}', 'group':'{{ ec2_security_group }}', 'Name':'demo_''{{ tower_user_name }}'}"
count="{{ ec2_instance_count }}"
register: ec2
- name: Launch database instance
ec2: >
access_key="{{ ec2_access_key }}"
secret_key="{{ ec2_secret_key }}"
keypair="{{ ec2_keypair }}"
group="{{ ec2_security_group }}"
type="{{ ec2_instance_type }}"
image="{{ ec2_image }}"
region="{{ ec2_region }}"
instance_tags="{'ansible_group':'{{ ec2_tag_dbservers }}', 'type':'{{ ec2_instance_type }}', 'group':'{{ ec2_security_group }}', 'Name':'demo_''{{ tower_user_name }}'}"
count="1"
register: ec2
- name: Launch load balancing instance
ec2: >
access_key="{{ ec2_access_key }}"
secret_key="{{ ec2_secret_key }}"
keypair="{{ ec2_keypair }}"
group="{{ ec2_security_group }}"
type="{{ ec2_instance_type }}"
image="{{ ec2_image }}"
region="{{ ec2_region }}"
instance_tags="{'ansible_group':'{{ ec2_tag_lbservers }}', 'type':'{{ ec2_instance_type }}', 'group':'{{ ec2_security_group }}', 'Name':'demo_''{{ tower_user_name }}'}"
count="1"
register: ec2
- name: Launch monitoring instance
ec2: >
access_key="{{ ec2_access_key }}"
secret_key="{{ ec2_secret_key }}"
keypair="{{ ec2_keypair }}"
group="{{ ec2_security_group }}"
type="{{ ec2_instance_type }}"
image="{{ ec2_image }}"
region="{{ ec2_region }}"
instance_tags="{'ansible_group':'{{ ec2_tag_monitoring }}', 'type':'{{ ec2_instance_type }}', 'group':'{{ ec2_security_group }}', 'Name':'demo_''{{ tower_user_name }}'}"
count="1"
register: ec2
- name: Wait for SSH to come up
local_action: wait_for host={{ item.public_dns_name }}
port=22 delay=60 timeout=320 state=started
with_items: "{{ ec2.instances }}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment