June 2017
Intermediate to advanced
446 pages
10h 10m
English
Jinja2 also supports and an if conditional checking. Let's add this field in for turning on the netflow feature for certain devices. We will add the following to the nxos.j2 template:
{% if item.value.netflow_enable %} feature netflow {% endif %}
The playbook is here:
vars: nexus_devices: { <skip> "netflow_enable": True <skip> }
The last step we will undertake is to make the nxos.j2 more scalable by placing the vlan interface section inside of a true-false conditional check. In the real world, most often, we will have multiple devices with knowledge of the vlan information but only one device as the gateway for client hosts:
{% if item.value.l3_vlan_interfaces %} {% for vlan_interface in item.value.vlan_interfaces ...Read now
Unlock full access