forked from yankurniawan/ansible-for-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2_vpc_web_create.yml
35 lines (35 loc) · 953 Bytes
/
ec2_vpc_web_create.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
---
- hosts: localhost
connection: local
gather_facts: no
vars_files:
- staging_vpc_info
vars:
region: ap-southeast-2
key: yan-key-pair-apsydney
instance_type: t2.micro
image: ami-d9fe9be3
prefix: staging
tasks:
- name: web instance provisioning
local_action:
module: ec2
region: "{{ region }}"
key_name: "{{ key }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
wait: yes
group: "{{ prefix }}_sg_web"
instance_tags:
Name: "{{ prefix }}_web"
class: web
environment: staging
id: web_launch_01
vpc_subnet_id: "{{ staging_subnet_public }}"
register: ec2
- name: associate new EIP for the instance
local_action:
module: ec2_eip
region: "{{ region }}"
instance_id: "{{ item.id }}"
with_items: ec2.instances