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

View file

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