HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
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 %}