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/os9/roles/os9_lag/templates/os9_lag.j2
#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 %}