2026-03-06 21:08:48 +00:00
|
|
|
---
|
2026-03-07 01:44:25 +00:00
|
|
|
# Configure laconic-was-sw01 for inbound validator traffic relay
|
2026-03-06 21:08:48 +00:00
|
|
|
#
|
2026-03-07 01:44:25 +00:00
|
|
|
# Routes all traffic destined to 137.239.194.65 to mia-sw01 via backbone.
|
|
|
|
|
# A single static route replaces the previous Loopback101 + PBR approach.
|
2026-03-06 21:08:48 +00:00
|
|
|
#
|
2026-03-07 01:44:25 +00:00
|
|
|
# 137.239.194.65 is already routed to was-sw01 by its covering prefix
|
|
|
|
|
# (advertised via IS-IS on Loopback100). No loopback needed — the static
|
|
|
|
|
# route forwards traffic before the switch tries to deliver it locally.
|
|
|
|
|
#
|
|
|
|
|
# This playbook also removes the old PBR config if present (Loopback101,
|
|
|
|
|
# VALIDATOR-RELAY-ACL, VALIDATOR-RELAY-CLASS, VALIDATOR-RELAY policy-map,
|
|
|
|
|
# service-policy on Et1/1).
|
2026-03-06 21:08:48 +00:00
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
|
# ansible-playbook -i inventory/switches.yml playbooks/ashburn-relay-was-sw01.yml
|
2026-03-07 01:44:25 +00:00
|
|
|
# ansible-playbook -i inventory/switches.yml playbooks/ashburn-relay-was-sw01.yml -e apply=true
|
2026-03-06 21:08:48 +00:00
|
|
|
# ansible-playbook -i inventory/switches.yml playbooks/ashburn-relay-was-sw01.yml -e commit=true
|
|
|
|
|
# ansible-playbook -i inventory/switches.yml playbooks/ashburn-relay-was-sw01.yml -e rollback=true
|
|
|
|
|
|
|
|
|
|
- name: Configure was-sw01 inbound validator relay
|
|
|
|
|
hosts: was-sw01
|
|
|
|
|
gather_facts: false
|
|
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
ashburn_ip: 137.239.194.65
|
2026-03-07 01:44:25 +00:00
|
|
|
apply: false
|
2026-03-06 21:08:48 +00:00
|
|
|
commit: false
|
|
|
|
|
rollback: false
|
2026-03-07 01:44:25 +00:00
|
|
|
session_name: validator-relay-v2
|
|
|
|
|
checkpoint_name: pre-validator-relay-v2
|
2026-03-06 21:08:48 +00:00
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
# Rollback path
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
- name: Rollback to checkpoint
|
|
|
|
|
when: rollback | bool
|
|
|
|
|
block:
|
|
|
|
|
- name: Execute rollback
|
|
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- "rollback running-config checkpoint {{ checkpoint_name }}"
|
|
|
|
|
- write memory
|
|
|
|
|
register: rollback_result
|
|
|
|
|
|
|
|
|
|
- name: Show rollback result
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
var: rollback_result.stdout_lines
|
|
|
|
|
|
|
|
|
|
- name: End play after rollback
|
|
|
|
|
ansible.builtin.meta: end_play
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
# Commit finalization
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
- name: Finalize pending session
|
|
|
|
|
when: commit | bool
|
|
|
|
|
block:
|
|
|
|
|
- name: Commit session and write memory
|
|
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- "configure session {{ session_name }} commit"
|
|
|
|
|
- write memory
|
|
|
|
|
register: commit_result
|
|
|
|
|
|
|
|
|
|
- name: Show commit result
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
var: commit_result.stdout_lines
|
|
|
|
|
|
|
|
|
|
- name: End play after commit
|
|
|
|
|
ansible.builtin.meta: end_play
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
2026-03-07 01:44:25 +00:00
|
|
|
# Pre-flight checks
|
2026-03-06 21:08:48 +00:00
|
|
|
# ------------------------------------------------------------------
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Show current Et1/1 config
|
2026-03-06 21:08:48 +00:00
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- show running-config interfaces Ethernet1/1
|
|
|
|
|
register: et1_config
|
2026-03-07 01:44:25 +00:00
|
|
|
tags: [preflight]
|
2026-03-06 21:08:48 +00:00
|
|
|
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Display Et1/1 config
|
2026-03-06 21:08:48 +00:00
|
|
|
ansible.builtin.debug:
|
|
|
|
|
var: et1_config.stdout_lines
|
2026-03-07 01:44:25 +00:00
|
|
|
tags: [preflight]
|
2026-03-06 21:08:48 +00:00
|
|
|
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Check for existing Loopback101 and PBR
|
2026-03-06 21:08:48 +00:00
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
2026-03-07 01:44:25 +00:00
|
|
|
- "show running-config interfaces Loopback101"
|
2026-03-06 21:08:48 +00:00
|
|
|
- "show running-config | include service-policy"
|
2026-03-07 01:44:25 +00:00
|
|
|
- "show running-config section policy-map type pbr"
|
|
|
|
|
- "show ip route {{ ashburn_ip }}"
|
|
|
|
|
register: existing_config
|
|
|
|
|
tags: [preflight]
|
|
|
|
|
|
|
|
|
|
- name: Display existing config
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
var: existing_config.stdout_lines
|
|
|
|
|
tags: [preflight]
|
2026-03-06 21:08:48 +00:00
|
|
|
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Pre-flight summary
|
|
|
|
|
when: not (apply | bool)
|
2026-03-06 21:08:48 +00:00
|
|
|
ansible.builtin.debug:
|
2026-03-07 01:44:25 +00:00
|
|
|
msg: |
|
|
|
|
|
=== Pre-flight complete ===
|
|
|
|
|
Review the output above:
|
|
|
|
|
1. Does Loopback101 exist with {{ ashburn_ip }}? (will be removed)
|
|
|
|
|
2. Is service-policy VALIDATOR-RELAY on Et1/1? (will be removed)
|
|
|
|
|
3. Current route for {{ ashburn_ip }}
|
|
|
|
|
|
|
|
|
|
To apply config:
|
|
|
|
|
ansible-playbook -i inventory/switches.yml playbooks/ashburn-relay-was-sw01.yml \
|
|
|
|
|
-e apply=true
|
|
|
|
|
tags: [preflight]
|
|
|
|
|
|
|
|
|
|
- name: End play if not applying
|
|
|
|
|
when: not (apply | bool)
|
|
|
|
|
ansible.builtin.meta: end_play
|
2026-03-06 21:08:48 +00:00
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
2026-03-07 01:44:25 +00:00
|
|
|
# Apply config via session with 5-minute auto-revert
|
2026-03-06 21:08:48 +00:00
|
|
|
# ------------------------------------------------------------------
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Save checkpoint
|
2026-03-06 21:08:48 +00:00
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- "configure checkpoint save {{ checkpoint_name }}"
|
|
|
|
|
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Apply config session
|
2026-03-06 21:08:48 +00:00
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- command: "configure session {{ session_name }}"
|
2026-03-07 01:44:25 +00:00
|
|
|
# Remove old PBR service-policy from Et1/1
|
2026-03-06 21:08:48 +00:00
|
|
|
- command: interface Ethernet1/1
|
2026-03-07 01:44:25 +00:00
|
|
|
- command: no service-policy type pbr input VALIDATOR-RELAY
|
2026-03-06 21:08:48 +00:00
|
|
|
- command: exit
|
2026-03-07 01:44:25 +00:00
|
|
|
# Remove old PBR policy-map, class-map, ACL
|
|
|
|
|
- command: no policy-map type pbr VALIDATOR-RELAY
|
|
|
|
|
- command: no class-map type pbr match-any VALIDATOR-RELAY-CLASS
|
|
|
|
|
- command: no ip access-list VALIDATOR-RELAY-ACL
|
|
|
|
|
# Remove Loopback101
|
|
|
|
|
- command: no interface Loopback101
|
|
|
|
|
# Add static route to forward all traffic for ashburn IP to mia-sw01
|
|
|
|
|
- command: "ip route {{ ashburn_ip }}/32 {{ backbone_peer }}"
|
2026-03-06 21:08:48 +00:00
|
|
|
|
|
|
|
|
- name: Show session diff
|
|
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- "configure session {{ session_name }}"
|
|
|
|
|
- show session-config diffs
|
|
|
|
|
- exit
|
|
|
|
|
register: session_diff
|
|
|
|
|
|
|
|
|
|
- name: Display session diff
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
var: session_diff.stdout_lines
|
|
|
|
|
|
|
|
|
|
- name: Commit with 5-minute auto-revert
|
|
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
|
|
|
|
- "configure session {{ session_name }} commit timer 00:05:00"
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
# Verify
|
|
|
|
|
# ------------------------------------------------------------------
|
2026-03-07 01:44:25 +00:00
|
|
|
- name: Verify config
|
2026-03-06 21:08:48 +00:00
|
|
|
arista.eos.eos_command:
|
|
|
|
|
commands:
|
2026-03-07 01:44:25 +00:00
|
|
|
- "show ip route {{ ashburn_ip }}"
|
2026-03-06 21:08:48 +00:00
|
|
|
- show running-config interfaces Ethernet1/1
|
2026-03-07 01:44:25 +00:00
|
|
|
register: verify
|
2026-03-06 21:08:48 +00:00
|
|
|
|
|
|
|
|
- name: Display verification
|
|
|
|
|
ansible.builtin.debug:
|
2026-03-07 01:44:25 +00:00
|
|
|
var: verify.stdout_lines
|
2026-03-06 21:08:48 +00:00
|
|
|
|
|
|
|
|
- name: Reminder
|
|
|
|
|
ansible.builtin.debug:
|
|
|
|
|
msg: |
|
|
|
|
|
=== Config applied with 5-minute auto-revert ===
|
|
|
|
|
Session: {{ session_name }}
|
|
|
|
|
Checkpoint: {{ checkpoint_name }}
|
|
|
|
|
|
2026-03-07 01:44:25 +00:00
|
|
|
Changes applied:
|
|
|
|
|
1. Removed: Loopback101, VALIDATOR-RELAY PBR (ACL, class-map, policy-map, service-policy)
|
|
|
|
|
2. Added: ip route {{ ashburn_ip }}/32 {{ backbone_peer }}
|
|
|
|
|
|
2026-03-06 21:08:48 +00:00
|
|
|
The config will auto-revert in 5 minutes unless committed.
|
2026-03-07 01:44:25 +00:00
|
|
|
Verify on the switch, then commit:
|
2026-03-06 21:08:48 +00:00
|
|
|
configure session {{ session_name }} commit
|
|
|
|
|
write memory
|
|
|
|
|
|
|
|
|
|
To revert immediately:
|
|
|
|
|
ansible-playbook ... -e rollback=true
|