File: //lib/python3.9/site-packages/ansible_collections/dellemc/os10/roles/os10_lag/templates/os10_lag.j2
#jinja2: trim_blocks: True,lstrip_blocks: True
{################################
Purpose:
Configure LAG commands for os10 Devices.
os10_lag:
Po 12:
type: dynamic
min_links: 2
max_bundle_size: 2
lacp_system_priority: 2
channel_members:
- port: ethernet 1/1/31
mode: "active"
port_priority: 3
lacp_rate_fast: true
state: present
################################}
{% if os10_lag is defined and os10_lag %}
{% for key in os10_lag.keys() %}
{% set channel_id = key.split(" ") %}
{% set lag_vars = os10_lag[key] %}
{% if lag_vars.lacp_system_priority is defined %}
{% if lag_vars.lacp_system_priority %}
lacp system-priority {{ lag_vars.lacp_system_priority }}
{% else %}
no lacp system-priority
{% endif %}
{% endif %}
{% if lag_vars.state is defined and lag_vars.state == "absent" %}
no interface port-channel {{ channel_id[1] }}
{% else %}
interface port-channel{{ channel_id[1] }}
{% if lag_vars.min_links is defined %}
{% if lag_vars.min_links %}
minimum-links {{ lag_vars.min_links }}
{% else %}
no minimum-links
{% endif %}
{% endif %}
{% if lag_vars.max_bundle_size is defined %}
{% if lag_vars.max_bundle_size %}
lacp max-bundle {{ lag_vars.max_bundle_size }}
{% else %}
no lacp max-bundle
{% endif %}
{% endif %}
{% if lag_vars.lacp_fallback_enable is defined and lag_vars.lacp_fallback_enable %}
lacp fallback enable
{% endif %}
{% if lag_vars.channel_members is defined %}
{% for ports in lag_vars.channel_members %}
{% if ports.port is defined and ports.port %}
interface {{ ports.port }}
{% if lag_vars.type is defined and lag_vars.type == "static" %}
{% if ports.mode is defined and ports.mode == "on" %}
channel-group {{ channel_id[1] }} mode on
{% else %}
no channel-group
{% endif %}
{% elif lag_vars.type is defined and lag_vars.type == "dynamic" %}
{% if ports.mode is defined and ports.mode == "active" or ports.mode == "passive" %}
channel-group {{ channel_id[1] }} mode {{ ports.mode }}
{% else %}
no channel-group
{% endif %}
{% endif %}
{% if ports.lacp_rate_fast is defined %}
{% if ports.lacp_rate_fast %}
lacp rate fast
{% else %}
no lacp rate fast
{% endif %}
{% endif %}
{% if ports.port_priority is defined %}
{% if ports.port_priority %}
lacp port-priority {{ ports.port_priority }}
{% else %}
no lacp port-priority
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}