File: //lib/python3.9/site-packages/ansible_collections/dellemc/os6/roles/os6_lag/templates/os6_lag.j2
#jinja2: trim_blocks: True,lstrip_blocks: True
{################################
Purpose:
Configure LAG commands for os6 Devices.
os6_lag:
Po 1:
type: static
min_links: 2
hash: 7
channel_members:
- port: Te1/0/2
state: present
- port: Te1/0/1
state: absent
state: present
################################}
{% if os6_lag is defined and os6_lag %}
{% for key in os6_lag.keys() %}
{% set channel_id = key.split(" ") %}
{% set lag_vars = os6_lag[key] %}
{% if lag_vars.state is defined and lag_vars.state=="absent" %}
interface port-channel {{ channel_id[1] }}
no shutdown
no description
no hashing-mode
exit
{% else %}
interface port-channel {{ channel_id[1] }}
{% if lag_vars.hash is defined %}
{% if lag_vars.hash %}
hashing-mode {{ lag_vars.hash }}
{% else %}
no hashing-mode
{% endif %}
{% endif %}
{% if lag_vars.min_links is defined %}
{% if lag_vars.min_links %}
port-channel min-links {{ lag_vars.min_links }}
{% else %}
no port-channel min-links
{% endif %}
{% endif %}
exit
{% if lag_vars.channel_members is defined %}
{% for ports in lag_vars.channel_members %}
{% if lag_vars.type is defined and lag_vars.type == "static" %}
{% if ports.port is defined and ports.port %}
{% if ports.state is defined and ports.state=="absent" %}
interface {{ ports.port }}
no channel-group
exit
{% else %}
interface {{ ports.port }}
channel-group {{ channel_id[1] }} mode on
exit
{% endif %}
{% endif %}
{% elif lag_vars.type is defined and lag_vars.type == "dynamic" %}
{% if ports.port is defined and ports.port %}
{% if ports.state is defined and ports.state=="absent" %}
interface {{ ports.port }}
no channel-group
exit
{% else %}
interface {{ ports.port }}
channel-group {{ channel_id[1] }} mode active
exit
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}