-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplaybook-ec2-vaults.yml
37 lines (34 loc) · 1.03 KB
/
playbook-ec2-vaults.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
- hosts: 127.0.0.1 # all | testepunk | "{{ tenant }}"
connection: local
vars_files:
- awsvault
- nametest2
tasks:
- ec2:
key_name: camidevops
aws_access_key: "{{aws_access_key_teste}}"
aws_secret_key: "{{aws_secret_key_teste}}"
region: us-east-2
instance_type: t2.micro
image: ami-026dea5602e368e96
wait: yes
count: 1
group: default
instance_tags:
Name: "{{nameinvault}} "
monitoring: yes
termination_protection: no
assign_public_ip: yes
vpc_subnet_id: subnet-0ca60f40
register: deviceidlaunch
- name: allocate a new elastic IP and associate it with an instance
ec2_eip:
device_id: "{{ deviceidlaunch.instance_ids[0] }}" #"{{ item }}"
region: us-east-2
aws_access_key: "{{aws_access_key_teste}}"
aws_secret_key: "{{aws_secret_key_teste}}"
#loop: "{{ deviceidlaunch.instance_ids }}"
register: elasticip
- name: output the IP
debug:
msg: "Allocated IP inside a VPC is {{ elasticip.public_ip }}"