Skip to content

Commit

Permalink
move hard-coded names to vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Oct 24, 2024
1 parent c82085d commit 912191a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
16 changes: 7 additions & 9 deletions examples/layer2/post_fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- name: create a VPC
amazon.aws.ec2_vpc_net:
region: "{{ aws_region }}"
name: ansible-equinix-layer2-example
name: "{{ vpc_name }}"
cidr_block: "{{ aws_network_cidr }}"
register: created_vpc

Expand All @@ -47,14 +47,12 @@
amazon.aws.ec2_security_group:
region: "{{ aws_region }}"
vpc_id: "{{ created_vpc.vpc.id }}"
name: ansible-equinix-layer2-example
name: "{{ security_group_name }}"
description: sg for Equinix Ansible Layer 2 example
rules:
- proto: tcp
ports:
- 443
- proto: all
cidr_ip: 0.0.0.0/0
rule_desc: allow all on port 443
rule_desc: allow all traffic
register: created_sg

- name: Create new VPC endpoint for S3
Expand All @@ -73,14 +71,14 @@
community.aws.ec2_vpc_vgw:
region: "{{ aws_region }}"
vpc_id: "{{ created_vpc.vpc.id }}"
name: ansible-equinix-layer2-example
name: "{{ vpc_gateway_name }}"
register: created_vgw

- name: Create an association between VGW and connection
community.aws.directconnect_virtual_interface:
region: "{{ aws_region }}"
state: present
name: "ansible-equinix-layer2-example"
name: "{{ directconnect_vif_name }}"
public: false
connection_id: "{{ connection_response.connection.connection_id }}"
vlan: "{{ connection_response.connection.vlan }}"
Expand Down Expand Up @@ -108,7 +106,7 @@

- name: Look up the VRF we created earlier
equinix.cloud.metal_vrf:
name: example-vrf
name: "{{ vrf_name }}"
metro: "{{ metro }}"
local_asn: "{{ metal_side_asn }}"
ip_ranges:
Expand Down
2 changes: 1 addition & 1 deletion examples/layer2/pre_fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: create a VRF
equinix.cloud.metal_vrf:
name: example-vrf
name: "{{ vrf_name }}"
metro: "{{ metro }}"
local_asn: "{{ metal_side_asn }}"
ip_ranges:
Expand Down
5 changes: 5 additions & 0 deletions examples/layer2/vars/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metro: sv
operating_system: ubuntu_20_04
plan: c3.small.x86
interconnection_name: "layer2 interconnection"
vrf_name: "example-vrf"
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"
Expand All @@ -16,3 +17,7 @@ fabric_connection_name: ansible-layer2-example
# AWS variables
aws_network_cidr: 172.16.0.0/16
aws_region: us-west-1
directconnect_vif_name: ansible-equinix-layer2-example
security_group_name: ansible-equinix-layer2-example
vpc_gateway_name: ansible-equinix-layer2-example
vpc_name: ansible-equinix-layer2-example

0 comments on commit 912191a

Please sign in to comment.