move to Elastic IP (#512)

This commit is contained in:
Jack Ivanov 2017-05-04 14:33:31 +02:00 committed by Dan Guido
parent 9f698fdd68
commit 6f170982aa
2 changed files with 12 additions and 8 deletions

View file

@ -26,7 +26,7 @@
- name: Add new instance to host group
add_host:
hostname: "{{ stack.stack_outputs.PublicIP }}"
hostname: "{{ stack.stack_outputs.ElasticIP }}"
groupname: vpn-host
ansible_ssh_user: ubuntu
ansible_python_interpreter: "/usr/bin/python2.7"
@ -35,7 +35,7 @@
ipv6_support: yes
- set_fact:
cloud_instance_ip: "{{ stack.stack_outputs.PublicIP }}"
cloud_instance_ip: "{{ stack.stack_outputs.ElasticIP }}"
- name: Get EC2 instances
ec2_remote_facts:

View file

@ -36,7 +36,7 @@ Resources:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: {{ ec2_vpc_nets.subnet_cidr }}
MapPublicIpOnLaunch: true
MapPublicIpOnLaunch: false
Tags:
- Key: Environment
Value: Algo
@ -184,9 +184,13 @@ Resources:
- Key: Environment
Value: Algo
Outputs:
PublicIP:
Value:
Fn::GetAtt:
ElasticIP:
Type: AWS::EC2::EIP
Properties:
InstanceId: !Ref EC2Instance
DependsOn:
- EC2Instance
- PublicIp
Outputs:
ElasticIP:
Value: !Ref ElasticIP