forked from yankurniawan/ansible-for-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathec2_vpc_openvpn.yml
37 lines (36 loc) · 1002 Bytes
/
ec2_vpc_openvpn.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
---
- hosts: localhost
gather_facts: no
vars_files:
- staging_vpc_info
vars:
region: ap-southeast-2
key: yan-key-pair-apsydney
instance_type: t2.micro
image: ami-a17f199b
prefix: staging
vpc_subnet_id: "{{ staging_subnet_public_0 }}"
tasks:
- name: openvpn server instance provisioning
local_action:
module: ec2
region: "{{ region }}"
key_name: "{{ key }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
source_dest_check: no
wait: yes
group: "{{ prefix }}_sg_openvpn"
instance_tags:
Name: "{{ prefix }}_openvpn"
class: openvpn
environment: "{{ prefix }}"
id: openvpn_launch_02
vpc_subnet_id: "{{ vpc_subnet_id }}"
register: ec2
- name: associate new EIP for the instance
local_action:
module: ec2_eip
region: "{{ region }}"
instance_id: "{{ item.id }}"
with_items: ec2.instances