Skip to content

Commit

Permalink
jinja-yaml - add whitespace around variable in curly braces
Browse files Browse the repository at this point in the history
jinja-yaml - add whitespace around variable in curly braces based on best practices in official Jinja documentation

ex: {{vrf}} becomes {{ vrf }}
  • Loading branch information
mjbear committed Mar 7, 2024
1 parent ba850cc commit f42456c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions workshops/jinja-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ aaa authentication login default {{ global['aaa_authentication']['login']['defau
aaa authorization exec default {{ global['aaa_authorization']['exec']['default'] }}
# Render clock timezone config line
clock timezone {{ global['clock']['timezone']}}
clock timezone {{ global['clock']['timezone'] }}
```

As you can see, the variable has many parameters in them. Lets walk through these parameters using the `aaa authentication` config line.
Expand Down Expand Up @@ -922,7 +922,7 @@ vxlan udp-port 4789
{% for vrf,vrf_values in vrf.items() %}
vxlan vrf {{vrf}} vni {{ vrf_values['l3vni']}}
vxlan vrf {{ vrf }} vni {{ vrf_values['l3vni'] }}
{% for vlan,vlan_values in vrf_values['vlans'].items() %}
Expand Down Expand Up @@ -954,7 +954,7 @@ First we will look at the `vrf` variables, and we will do this by changing the t
vxlan source-interface loopback1
vxlan udp-port 4789 #}
{% for vrf,vrf_values in vrf.items() %}
{# vxlan vrf {{vrf}} vni {{ vrf_values['l3vni']}} #}
{# vxlan vrf {{ vrf }} vni {{ vrf_values['l3vni'] }} #}
{{ vrf }}
{% for vlan,vlan_values in vrf_values['vlans'].items() %}
Expand Down Expand Up @@ -994,7 +994,7 @@ Now lets take a look at the `_params` variable. Changing the template to what fo
vxlan source-interface loopback1
vxlan udp-port 4789 #}
{% for vrf,vrf_values in vrf.items() %}
{# vxlan vrf {{vrf}} vni {{ vrf_values['l3vni']}} #}
{# vxlan vrf {{ vrf }} vni {{ vrf_values['l3vni'] }} #}
{# {{ vrf }} #}
{{ vrf_values }}
Expand Down Expand Up @@ -1034,7 +1034,7 @@ vxlan udp-port 4789
{% for vrf,vrf_values in vrf.items() %}
vxlan vrf {{vrf}} vni {{ vrf_values['l3vni']}}
vxlan vrf {{ vrf }} vni {{ vrf_values['l3vni'] }}
{% for vlan,vlan_values in vrf_values['vlans'].items() %}
Expand Down Expand Up @@ -1209,9 +1209,9 @@ The Jinja template would look as follows:
ip radius vrf {{ radsrc['vrf'] }} source-interface {{ radsrc['name'] }}
{% endfor %}

mac address-table aging-time {{ global['mac_address_table']['aging_time']}}
mac address-table aging-time {{ global['mac_address_table']['aging_time'] }}

arp aging timeout {{ global['arp']['aging']['timeout_default']}}
arp aging timeout {{ global['arp']['aging']['timeout_default'] }}

{% for dns in global['name_servers'] %}
ip name-server {{ dns }}
Expand All @@ -1224,7 +1224,7 @@ The Jinja template would look as follows:
ntp server vrf {{ ntps['vrf'] }} {{ ntps['name'] }}
{% endfor %}

clock timezone {{ global['clock']['timezone']}}
clock timezone {{ global['clock']['timezone'] }}

vlan 4094
name MLAG
Expand Down

0 comments on commit f42456c

Please sign in to comment.