junos_lag_interfaces – Manage Link Aggregation on Juniper JUNOS devices — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# junos_lag_interfaces – Manage Link Aggregation on Juniper JUNOS devices

New in version 2.9.

- Synopsis
- Requirements
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- This module manages properties of Link Aggregation Group on Juniper JUNOS devices.

## Requirements

The below requirements are needed on the host that executes this module.

- ncclient (>=v0.6.4)

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
config list |  | A list of link aggregation group configurations.
| link_protection boolean | Choices: no yes | This boolean option indicates if link protection should be enabled for the LAG interface. If value is `True` link protection is enabled on LAG and if value is `False` link protection is disabled.
| members list |  | List of member interfaces of the link aggregation group. The value can be single interface or list of interfaces.
|  | link_type - | Choices: primary backup | The value of this options configures the member link as either `primary` or `backup`. Value `primary` configures primary interface for link-protection mode and `backup` configures backup interface for link-protection mode.
|  | member string |  | Name of the member interface.
| mode - | Choices: active passive | LAG mode. A value of `passive` will enable LACP in `passive` mode that is it will respond to LACP packets and `active` configures the link to initiate transmission of LACP packets.
| name string / required |  | Name of the link aggregation group (LAG).
state string | Choices: merged ← replaced overridden deleted | The state of the configuration after module completion

## Notes

Note

- This module requires the netconf system service be enabled on the remote device being managed.
- Tested against vSRX JUNOS version 18.4R1.
- This module works with connection `netconf`. See the Junos OS Platform Options.

## Examples

    # Using merged

    # Before state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ae0 {
    #     description "lag interface";
    # }
    # ae1 {
    #     description "lag interface 1";
    # }

    - name: "Delete LAG attributes of given interfaces (Note: This won't delete the interface itself)"
      junos_lag_interfaces:
        config:
          - name: ae0
          - name: ae1
        state: deleted

    # After state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    # }

    # Using merged

    # Before state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    # }

    - name: Merge provided configuration with device configuration
      junos_lag_interfaces:
        config:
          - name: ae0
            members:
              - member: ge-0/0/1
                link_type: primary
              - member: ge-0/0/2
                link_type: backup
        state: merged

    # After state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    #    ether-options {
    #        802.3ad {
    #            ae0;
    #            primary;
    #        }
    #    }
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    #    ether-options {
    #        802.3ad {
    #            ae0;
    #            backup;
    #        }
    #    }
    # }

    # Using merged

    # Before state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ae0 {
    #     description "lag interface";
    # }
    # ae3 {
    #     description "lag interface 3";
    # }

    - name: Overrides all device LAG configuration with provided configuration
      junos_lag_interfaces:
        config:
          - name: ae0
            members:
              - member: ge-0/0/2
          - name: ae1
            members:
              - member: ge-0/0/1
            mode: passive
        state: overridden

    # After state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    #    ether-options {
    #        802.3ad ae1;
    #    }
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ae0 {
    #     description "lag interface";
    # }
    # ae1 {
    #    aggregated-ether-options {
    #        lacp {
    #            active;
    #        }
    #    }
    # }

    # Using merged

    # Before state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    # }
    # ge-0/0/3 {
    #    description "Ansible configured interface 3";
    # }

    - name: Replace device LAG configuration with provided configuration
      junos_lag_interfaces:
        config:
          - name: ae0
            members:
              - member: ge-0/0/1
            mode: active
        state: replaced

    # After state:
    # -------------
    # user@junos01# show interfaces
    # ge-0/0/1 {
    #    description "Ansible configured interface 1";
    #    ether-options {
    #        802.3ad ae0;
    #    }
    # }
    # ge-0/0/2 {
    #    description "Ansible configured interface 2";
    # }
    # ae0 {
    #    aggregated-ether-options {
    #        lacp {
    #            active;
    #        }
    #    }
    # }
    # ge-0/0/3 {
    #    description "Ansible configured interface 3";
    # }

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
after list | when changed | The configuration as structured data after module completion. Sample: The configuration returned will always be in the same format of the parameters above.
before list | always | The configuration as structured data prior to module invocation. Sample: The configuration returned will always be in the same format of the parameters above.
xml list | always | The set of xml rpc payload pushed to the remote device. Sample: ['xml 1', 'xml 2', 'xml 3']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Ganesh Nalawade (@ganeshrn)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.