-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfra.yml
42 lines (39 loc) · 1008 Bytes
/
infra.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
39
40
41
42
---
- name: Configuring the EC2 Instance
hosts: localhost
connection: local
vars:
count: {{ count }}
volumes:
- device_name: /dev/sda1
volume_size: {{ volume-size }}
- name: Launching an EC2 Instance
local_action: ec2
instance_type={{ instance_type}}
image={{ ami }}
region={{ region }}
keypair={{ pem }}
count={{count}}
instance_profile_name={{ instance_profile_name }}
group={{ security_group }}
wait=true
volumes={{volumes}}
register: ec2
- name: Waiting for the instance to come
local_action: wait_for
host={{ item.private_ip }}
state=started
port=22
with_items: ec2.instance
- name: Adding tags to the EC2 Instance
local_action: ec2_tag
region={{ region }}
resource={{ item.id }}
state=present
with_items: ec2.instances
args:
tags:
Name: "{{ name }}"
Env: "{{ Env }}"
Type: Appservice
register: tag