dellemc.os9/roles/os9_lag/templates/os9_lag.j2
Komal Uttamrao Patil 90b090b021
OS9 Ansible Collections (#2)
* adding OS9 ansible collections

* adding OS9 collections

Co-authored-by: Patil <Komal_uttamrao_Patil@Dell.com>
2020-07-09 19:29:51 -07:00

114 lines
No EOL
3.3 KiB
Django/Jinja

#jinja2: trim_blocks: True,lstrip_blocks: True
{################################
Purpose:
Configure LAG commands for os9 Devices.
os9_lag:
Po 1:
type: static
min_links: 3
lacp:
long_timeout: true
fast_switchover: true
lacp_system_priority: 2
lacp_ungroup:
- port_channel: 1
state: present
lacp_ungroup_vlt: true
channel_members:
- port: fortyGigE 0/4
state: present
state: present
###############################}
{% if os9_lag is defined and os9_lag %}
{% for key in os9_lag.keys() %}
{% set channel_id = key.split(" ") %}
{% set lag_vars = os9_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.lacp_ungroup_vlt is defined %}
{% if lag_vars.lacp_ungroup_vlt %}
lacp ungroup member-independent vlt
{% else %}
no lacp ungroup member-independent vlt
{% endif %}
{% endif %}
{% if lag_vars.lacp_ungroup is defined %}
{% if lag_vars.lacp_ungroup %}
{% for port in lag_vars.lacp_ungroup %}
{% if port.port_channel is defined and port.port_channel %}
{% if port.state is defined and port.state == "absent" %}
no lacp ungroup member-independent port-channel {{ port.port_channel }}
{% else %}
lacp ungroup member-independent port-channel {{ port.port_channel }}
{% endif %}
{% endif %}
{% endfor %}
{% 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.lacp is defined and lag_vars.lacp %}
{% if lag_vars.lacp.fast_switchover is defined %}
{% if lag_vars.lacp.fast_switchover %}
lacp fast-switchover
{% else %}
no lacp fast-switchover
{% endif %}
{% endif %}
{% if lag_vars.lacp.long_timeout is defined %}
{% if lag_vars.lacp.long_timeout %}
lacp long-timeout
{% else %}
no lacp long-timeout
{% endif %}
{% endif %}
{% endif %}
{% 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" %}
no channel-member {{ ports.port }}
{% else %}
channel-member {{ ports.port }}
{% 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 port-channel-protocol LACP
{% else %}
interface {{ ports.port }}
port-channel-protocol LACP
port-channel {{ channel_id[1] }} mode active
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}