-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest-ec2.yml
34 lines (31 loc) · 925 Bytes
/
test-ec2.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
- name: Provision ec2 instances based on the environment
hosts: localhost
connection: local
gather_facts: True
vars_files:
# - roles/ec2/vars/aws_creds.yml
tasks:
- name: Provision simple instance
ec2:
# ec2_access_key: "{{ ec2_access_key }}"
# ec2_secret_key: "{{ ec2_secret_key }}"
region: ap-southeast-2
key_name: "{{ aws_keys }}"
group: "{{ security_group }}"
instance_type: t2.micro
# image: ami-ccecf5af
#fedora image: ami-0038f562
# RHEL image: ami-67589505
image: "{{ image_id }}"
wait: true
count: "{{ instance_count }}"
count_tag:
Name: "{{ instance_name }}"
instance_tags:
Name: "{{ instance_tags }}"
register: ec2
- name: Wait for machines to come up completely
wait_for: host={{ item.public_dns_name }} port=22
with_items: '{{ec2.instances}}'
- name: ping to get facts
ping: