-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add second playbook for AWS automation after DX is accepted
- Loading branch information
Showing
5 changed files
with
99 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
# NOTE: this playbook should be run _after_: | ||
# 1. Running the metal.yml playbook | ||
# 2. Redeeming the Fabric service token in the Fabric portal | ||
# 3. Accepting the Direct Connect request in the AWS console | ||
- name: Equinix Layer 2 example -- AWS resources | ||
hosts: localhost | ||
gather_facts: no | ||
tasks: | ||
- name: Include the required variables | ||
include_vars: "vars/vars.yml" | ||
|
||
- name: create a VPC | ||
amazon.aws.ec2_vpc_net: | ||
name: ansible-equinix-layer2-example | ||
cidr_block: "{{ aws_network_cidr }}" | ||
region: "{{ aws_region }}" | ||
register: created_vpc | ||
|
||
- name: Gather information about any VPC route table within VPC with ID "{{ created_vpc.vpc.id }}" | ||
amazon.aws.ec2_vpc_route_table_info: | ||
filters: | ||
vpc-id: "{{ created_vpc.vpc.id }}" | ||
register: route_table_info | ||
|
||
- name: Create new vpc endpoint with the default policy | ||
amazon.aws.ec2_vpc_endpoint: | ||
region: "{{ aws_region }}" | ||
vpc_id: "{{ created_vpc.vpc.id }}" | ||
service: "com.amazonaws.{{ aws_region }}.s3" | ||
route_table_ids: "{{ route_table_info.route_tables | map(attribute='id') }}" | ||
register: new_vpc_endpoint | ||
|
||
- name: Create a new VGW attached to the VPC | ||
community.aws.ec2_vpc_vgw: | ||
region: "{{ aws_region }}" | ||
vpc_id: "{{ created_vpc.vpc.id }}" | ||
name: ansible-equinix-layer2-example | ||
register: created_vgw | ||
|
||
# TODO this is failing, saying that the virtual gateway | ||
# does not exist, but I can see it...so? | ||
- name: Create an association between VGW and connection | ||
community.aws.directconnect_virtual_interface: | ||
state: present | ||
region: "{{ aws_region }}" | ||
name: "ansible-equinix-layer2-example" | ||
public: false | ||
connection_id: "{{ aws_connection_id }}" | ||
vlan: "{{ aws_connection_vlan }}" | ||
virtual_gateway_id: "{{ created_vgw.vgw.id }}" | ||
customer_address: "{{ metal_peering_ip }}/30" | ||
amazon_address: "{{ aws_peering_ip }}/30" | ||
bgp_asn: "{{ vrf_peering_asn }}" | ||
authentication_key: "{{ bgp_md5_password }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Equinix variables | ||
project_name: my_metal_layer2_project | ||
device_hostname: layer2-device | ||
metro: sv | ||
operating_system: ubuntu_20_04 | ||
plan: c3.small.x86 | ||
interconnection_name: "ansible-layer2-example" | ||
vrf_gateway_ip_range: 192.168.200.0/25 | ||
vrf_peering_ip_network: 169.254.0.0 | ||
vrf_peering_ip_range: "{{ vrf_peering_ip_network }}/29" | ||
vrf_vc_peering_ip_range: "{{ vrf_peering_ip_network }}/30" | ||
metal_peering_ip: "{{ vrf_vc_peering_ip_range | ansible.utils.nthhost(2) }}" | ||
aws_peering_ip: "{{ vrf_vc_peering_ip_range | ansible.utils.nthhost(1) }}" | ||
vrf_peering_asn: 65100 | ||
fabric_connection_name: ansible-layer2-example | ||
# AWS variables | ||
aws_network_cidr: 172.16.0.0/16 | ||
aws_region: us-west-1 |