Chapter 8 Data Models and Dynamic Templates
For diagrams, tables, or exact code formatting, .
JOHN W. CAPOBIANCOPRINTED PAGE 158
service-policy input PM-QoS-IN
service-policy output PM-QoS-OUT-Access
{% endif %}
{% if platform_defaults.type == 3750 %}
service-policy input PM-QoS-IN
{% endif %}
{% if host_interfaces[host_interface].service_policy.input is defined
%}
service-policy input {{ host_interfaces[host_interface].service_policy.input }}
{% endif %}
{% if host_interfaces[host_interface].service_policy.output is
defined %}
service-policy output {{ host_interfaces[host_interface].service_policy.output }}
{% endif %}
{% endif %}
{% if platform_defaults.type == 3750 or platform_defaults.type == 3850 %}
{% if host_interfaces[host_interface].storm_control_broadcast is
defined %}
{% if host_interfaces[host_interface].storm_control_broadcast ==
false %}
{% else %}
storm-control broadcast level 30.00
{% endif %}
{% endif %}
{% if host_interfaces[host_interface].storm_control_multicast is
defined %}
{% if host_interfaces[host_interface].storm_control_multicast ==
false %}
{% else %}
storm-control multicast level 30.00
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Create Tasks
Ansible tasks include an Ansible module and reference the Jinja2 templates. These tasks are called
from the Ansible playbook. A YAML task file is required for each of Jinaj2 template file. Examples of
tasks:Global Configuration
---
- name: Create IOS Global configuration
ios_config:
src: ../../templates/configurations/ios/01_ios_global.j2
provider: "{{ ioscli }}"
register: global_config_results