File tree Expand file tree Collapse file tree 5 files changed +3
-45
lines changed Expand file tree Collapse file tree 5 files changed +3
-45
lines changed Original file line number Diff line number Diff line change @@ -131,12 +131,9 @@ cloud_providers:
131
131
size: s-1vcpu-1gb
132
132
image: " ubuntu-18-04-x64"
133
133
ec2:
134
- # Change the encrypted flag to "true" to enable AWS volume encryption, for encryption of data at rest.
135
- # Warning: the Algo script will take approximately 6 minutes longer to complete.
134
+ # Change the encrypted flag to "true" to enable AWS volume encryption, for encryption of data at rest.
135
+ # Warning: the Algo script will take approximately 6 minutes longer to complete.
136
136
encrypted: false
137
- # Set use_existing_eip to "true" if you want to use a pre-allocated Elastic IP
138
- # Additional prompt will be raised to determine which IP to use
139
- use_existing_eip: true
140
137
size: t2.micro
141
138
image:
142
139
name: " ubuntu-bionic-18.04"
Original file line number Diff line number Diff line change @@ -5,4 +5,3 @@ ec2_vpc_nets:
5
5
cidr_block : 172.16.0.0/16
6
6
subnet_cidr : 172.16.254.0/23
7
7
ec2_venv : " {{ playbook_dir }}/configs/.venvs/aws"
8
- existing_eip : " "
Original file line number Diff line number Diff line change @@ -11,12 +11,6 @@ Parameters:
11
11
Type : String
12
12
WireGuardPort :
13
13
Type : String
14
- UseThisElasticIP :
15
- Type : String
16
- Default : ' '
17
- Conditions :
18
- AllocateNewEIP : !Equals [!Ref UseThisElasticIP, '']
19
- AssociateExistingEIP : !Not [!Equals [!Ref UseThisElasticIP, '']]
20
14
Resources :
21
15
VPC :
22
16
Type : AWS::EC2::VPC
@@ -181,22 +175,13 @@ Resources:
181
175
182
176
ElasticIP :
183
177
Type : AWS::EC2::EIP
184
- Condition : AllocateNewEIP
185
178
Properties :
186
179
Domain : vpc
187
180
InstanceId : !Ref EC2Instance
188
181
DependsOn :
189
182
- EC2Instance
190
183
- VPCGatewayAttachment
191
184
192
- ElasticIPAssociation :
193
- Type : AWS::EC2::EIPAssociation
194
- Condition : AssociateExistingEIP
195
- Properties :
196
- AllocationId : !Ref UseThisElasticIP
197
- InstanceId : !Ref EC2Instance
198
-
199
-
200
185
Outputs :
201
186
ElasticIP :
202
- Value : !GetAtt [EC2Instance, PublicIp]
187
+ Value : !Ref ElasticIP
Original file line number Diff line number Diff line change 12
12
PublicSSHKeyParameter : " {{ lookup('file', SSH_keys.public) }}"
13
13
ImageIdParameter : " {{ ami_image }}"
14
14
WireGuardPort : " {{ wireguard_port }}"
15
- UseThisElasticIP : " {{ existing_eip }}"
16
15
tags :
17
16
Environment : Algo
18
17
register : stack
Original file line number Diff line number Diff line change 53
53
[{{ default_region }}]
54
54
register : _algo_region
55
55
when : region is undefined
56
-
57
- - block :
58
- - name : Get existing available Elastic IPs
59
- ec2_eip_facts :
60
- register : raw_eip_addresses
61
-
62
- - set_fact :
63
- available_eip_addresses : " {{ raw_eip_addresses.addresses | selectattr('association_id', 'undefined') | list }}"
64
-
65
- - pause :
66
- prompt : >-
67
- What Elastic IP would you like to use?
68
- {% for eip in available_eip_addresses %}
69
- {{ loop.index }}. {{ eip['public_ip'] }}
70
- {% endfor %}
71
-
72
- Enter the number of your desired Elastic IP
73
- register : _use_existing_eip
74
-
75
- - set_fact :
76
- existing_eip : " {{ available_eip_addresses[_use_existing_eip.user_input | int -1 ]['allocation_id'] }}"
77
- when : cloud_providers.ec2.use_existing_eip
You can’t perform that action at this time.
0 commit comments