Chapter 8 Data Models and Dynamic Templates

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 145
network 172.20.{{ host_defaults.site_id }}.0 0.0.0.3 area {{ host_vrfs[host_vrf].tag 
}} 
{%          endif %} 
{%          if host_vrfs[host_vrf].networks is defined %} 
{%              for network in host_vrfs[host_vrf].networks %} 
{%                  for value in host_vrfs[host_vrf].networks[network].value %} 
 network {{ value }} area {{ network }} 
{%                  endfor %} 
{%              endfor %} 
{%          endif %} 
{%          if host_vrfs[host_vrf].default_originate is defined %} 
 default-information originate always 
{%          endif %} 
{%      endfor %} 
{%  endif %} 
 
Static Routes 
 
{%  if host_static_routes is defined %} 
{%      for host_static_route in host_static_routes %} 
{%          for route in host_static_routes[host_static_route].routes %} 
{%              if host_static_route == "global" %} 
ip route {{ route }} 
{%              else %} 
ip route vrf {{ host_static_route }} {{ route }} 
{%              endif %} 
{%          endfor %} 
{%      endfor %} 
{%  endif %} 
 
 
Data model – host_vars file CORE.yml. 
 
host_static_routes: 
  global: 
    routes: 
    - "0.0.0.0 0.0.0.0 172.20.205.114 name Management_Outside_to_Firewall" 
    - "192.168.100.0 255.255.192.0 172.20.200.100 name Switch_Management_Traffic" 
    - "192.168.120.0 255.255.255.0 172.18.100.50 name Load_Balancer" 
    - "192.168.130.0 255.255.224.0 192.168.200.132 name WAN_Management_to_Firewall" 
    - "192.168.140.0 255.255.224.0 192.168.220.132 name WAN_WAPs_to_Firewall" 
 
  GREEN_Zone: 
    routes: 
    - "192.168.0.0 255.252.0.0 192.168.1.100 name WAN GREEN_Zone_Transit_to_Firewall" 
    - "192.168.3.0 255.255.255.0 192.168.200.100 name Voice_Transit_to_Firewall" 
 
  WAN_Zone: 
    routes: 
    - "0.0.0.0 0.0.0.0 172.20.205.146 name WAN Traffic_to_AWS" 
    - "10.0.0.0 255.0.0.0 172.20.205.146 name WAN Traffic to AWS" 
    - "192.168.0.0 255.240.0.0 172.20.205.146 name WAN Traffic to AWS"