mirror of
https://github.com/trailofbits/algo.git
synced 2025-09-06 20:13:11 +02:00
Allocate an EIP in AWS
based on pc-0's PR https://github.com/trailofbits/algo/pull/343
This commit is contained in:
parent
25e0e9085d
commit
c00507bef8
1 changed files with 13 additions and 2 deletions
|
@ -104,9 +104,20 @@
|
||||||
instance_initiated_shutdown_behavior: terminate
|
instance_initiated_shutdown_behavior: terminate
|
||||||
register: ec2
|
register: ec2
|
||||||
|
|
||||||
|
- name: Allocate an EIP for the instances
|
||||||
|
ec2_eip:
|
||||||
|
aws_access_key: "{{ aws_access_key | default(lookup('env','AWS_ACCESS_KEY_ID'))}}"
|
||||||
|
aws_secret_key: "{{ aws_secret_key | default(lookup('env','AWS_SECRET_ACCESS_KEY'))}}"
|
||||||
|
region: "{{ region }}"
|
||||||
|
release_on_disassociation: yes
|
||||||
|
reuse_existing_ip_allowed: yes
|
||||||
|
in_vpc: yes
|
||||||
|
device_id: "{{ ec2.tagged_instances[0].id }}"
|
||||||
|
register: eip
|
||||||
|
|
||||||
- name: Add new instance to host group
|
- name: Add new instance to host group
|
||||||
add_host:
|
add_host:
|
||||||
hostname: "{{ item.public_ip }}"
|
hostname: "{{ eip.public_ip }}"
|
||||||
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"
|
||||||
|
@ -116,7 +127,7 @@
|
||||||
with_items: "{{ ec2.tagged_instances }}"
|
with_items: "{{ ec2.tagged_instances }}"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
cloud_instance_ip: "{{ ec2.tagged_instances[0].public_ip }}"
|
cloud_instance_ip: "{{ eip.public_ip }}"
|
||||||
|
|
||||||
- name: Get EC2 instances
|
- name: Get EC2 instances
|
||||||
ec2_remote_facts:
|
ec2_remote_facts:
|
||||||
|
|
Loading…
Add table
Reference in a new issue