This repository is an Ansible-based network automation solution for the topology in the diagram:
The design is:
host_vars/ and group_vars/.⚠️ You must lab‑test and adapt IPs, passwords, and policy to your real environment before touching production.

The credit of this topology goes to Randy Pratma Putra (https://www.linkedin.com/in/randy-pratama-putra/)
Install collections:
ansible-galaxy collection install -r requirements.yml
Groups (from inventory/hosts.yml):
hq_core – Core-01, Core-02hq_access – Switch-01…Switch-04dc_core – Core-SW01, Core-SW02dc_dist – Dist-SW01, Dist-SW02dc_access – Access-SW01…Access-SW04firewalls – Firewall-HQ, Firewall-DCEach host has its own host_vars/<hostname>.yml file describing:
/29 interconnects as per the diagram)base – hostname, domain, NTP, syslog, SNMP, timezonelayer2 – VLANs, access interfaces, trunk interfaceslayer3 – SVIs, routed interfaces, OSPF, static default routevpn_firewall – hostname + inside/outside interface config, with a clear TODO for IPsec policyRoles are intentionally small and composable so they can be easily extended (QoS, port‑channels, security, etc.).
playbooks/hq.yml – Applies base, layer2, layer3 to HQ core; base, layer2 to HQ access.playbooks/dc.yml – Applies roles to DC core, distribution, access.playbooks/firewalls.yml – Applies firewall base + IP interface config.playbooks/site.yml – Orchestrator that imports all of the above.Example usage:
# Dry run with diffs ansible-playbook playbooks/site.yml -C --diff # Actual deployment ansible-playbook playbooks/site.yml
This repo does not hardcode sensitive credentials:
inventory/hosts.yml.NET_PASSWORD.Example:
export NET_PASSWORD='YourStrongPassword!' ansible-playbook playbooks/site.yml
SNMP communities, NTP, syslog, and domain name are in group_vars/all.yml.
Adapt these to your org standards (SNMPv3, TACACS/RADIUS, etc.) before production.
Under tests/ you’ll find placeholders for:
pyATS – for VLAN, OSPF, and routing validation.Batfish – for pre‑change routing policy analysis.These are not fully implemented (they depend on your tooling), but the structure is ready to plug into CI/CD.
Clone this repo to a lab environment.
Replace mgmt IPs in inventory/hosts.yml with your real device IPs.
Adjust VLAN IDs, subnets, and OSPF areas if your implementation differs.
Run:
ansible-lint ansible-playbook playbooks/site.yml -C --diff
Validate end‑to‑end reachability and routing.
Only then run without -C in a change window.
This is a production‑style repository: structure, idempotency, and separation of concerns are ready; just adapt the data and any local standards (AAA, logging, naming conventions, etc.).
Owner
Contributors
Categories
Programming Languages
AnsibleLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community