Chapter 8 Data Models and Dynamic Templates
For diagrams, tables, or exact code formatting, .
JOHN W. CAPOBIANCOPRINTED PAGE 148
Port-channel Port-channels are treated as a service where both the port-channel and member interfaces are configured as part of the template and data model. Port-channel templates are available for both platform (group_vars) and host (host_vars) to offer maximum flexibility.
Platform
{% if platform_port_channels is defined %}
{% for platform_port_channel in platform_port_channels %}
interface {{ platform_port_channel }}
description {{ platform_port_channels[platform_port_channel].description }}
{% if platform_port_channels[platform_port_channel].vnet_list is defined %}
vnet trunk list {{ inventory_hostname }}
{% endif %}
{% if
platform_port_channels[platform_port_channel][inventory_hostname].ip_address is
defined %}
ip address {{
platform_port_channels[platform_port_channel][inventory_hostname].ip_address }}
{% endif %}
{% if
platform_port_channels[platform_port_channel][inventory_hostname].message_digest_key
is defined %}
ip ospf message-digest-key 1 md5 7 {{
platform_port_channels[platform_port_channel][inventory_hostname].message_digest_key
}}
{% endif %}
{% if platform_port_channels[platform_port_channel][inventory_hostname].pim
is defined %}
ip pim {{ platform_port_channels[platform_port_channel][inventory_hostname].pim }}
{% endif %}
{% if platform_port_channels[platform_port_channel].point_to_point is defined
%}
ip ospf network point-to-point
{% endif %}
{% if platform_port_channels[platform_port_channel].service_policy is defined
%}
{% if platform_port_channels[platform_port_channel].service_policy.input
is defined %}
service-policy input {{
platform_port_channels[platform_port_channel].service_policy.input }}
{% endif %}
{% if platform_port_channels[platform_port_channel].service_policy.output
is defined %}
service-policy output {{
platform_port_channels[platform_port_channel].service_policy.output }}
{% endif %}
{% endif %}
{% if platform_port_channels[platform_port_channel].switchport is defined %}
{% if platform_port_channels[platform_port_channel].switchport == true %}
switchport
switchport mode {{ platform_port_channels[platform_port_channel].switchport_mode }}