dellemc.os9/roles/os9_ecmp/templates/os9_ecmp.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

62 lines
No EOL
1.7 KiB
Django/Jinja

#jinja2: trim_blocks: True,lstrip_blocks: True
{####################################
Purpose:
Configure ECMP commands for os9 devices
os9_ecmp:
weighted_ecmp: true
ecmp_group_max_paths: 3
ecmp_group_path_fallback: true
ecmp 1:
interface:
- fortyGigE 1/49
- fortyGigE 1/51
link_bundle_monitor: true
state: present
#####################################}
{% if os9_ecmp is defined and os9_ecmp %}
{% if os9_ecmp.weighted_ecmp is defined %}
{% if os9_ecmp.weighted_ecmp %}
ip ecmp weighted
{% else %}
no ip ecmp weighted
{% endif %}
{% endif %}
{% if os9_ecmp.ecmp_group_max_paths is defined %}
{% if os9_ecmp.ecmp_group_max_paths %}
ip ecmp-group maximum-paths {{ os9_ecmp.ecmp_group_max_paths }}
{% else %}
no ip ecmp-group maximum-paths 2
{% endif %}
{% endif %}
{% if os9_ecmp.ecmp_group_path_fallback is defined %}
{% if os9_ecmp.ecmp_group_path_fallback %}
ip ecmp-group path-fallback
{% else %}
no ip ecmp-group path-fallback
{% endif %}
{% endif %}
{% for key in os9_ecmp.keys() %}
{% if " " in key %}
{% set ecmp_vars = os9_ecmp[key] %}
{% set group_num = key.split(" ") %}
{% if ecmp_vars.state is defined and ecmp_vars.state == "absent" %}
no ecmp-group {{ group_num[1] }}
{% else %}
ecmp-group {{ group_num[1] }}
{% if ecmp_vars.interface is defined and ecmp_vars.interface %}
{% for intf in ecmp_vars.interface %}
interface {{ intf }}
{% endfor %}
{% endif %}
{% if ecmp_vars.link_bundle_monitor is defined %}
{% if ecmp_vars.link_bundle_monitor %}
link-bundle-monitor enable
{% else %}
no link-bundle-monitor enable
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}