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

Documentation

# nxos_l3_interfaces – Manages Layer-3 Interfaces attributes of NX-OS Interfaces

New in version 2.9.

- Synopsis

- Parameters

- Notes

- Examples

- Return Values

- Status

## Synopsis

- This module manages Layer-3 interfaces attributes of NX-OS Interfaces.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
config list / elements=dictionary |  | A dictionary of Layer-3 interface options
| ipv4 list / elements=dictionary |  | IPv4 address and attributes of the L3 interface.
|  | address string |  | IPV4 address of the L3 interface.
|  | secondary boolean | Choices: no ← yes | A boolean attribute to manage addition of secondary IP address.
|  | tag integer |  | URIB route tag value for local/direct routes.
| ipv6 list / elements=dictionary |  | IPv6 address and attributes of the L3 interface.
|  | address string |  | IPV6 address of the L3 interface.
|  | tag integer |  | URIB route tag value for local/direct routes.
| name string / required |  | Full name of L3 interface, i.e. Ethernet1/1.
state string | Choices: merged ← replaced overridden deleted | The state of the configuration after module completion.

## Notes

Note

- Tested against NXOS 7.3.(0)D1(1) on VIRL

## Examples

    # Using merged

    # Before state:
    # -------------
    #
    # interface Ethernet1/6

    - name: Merge provided configuration with device configuration.
      nxos_l3_interfaces:
        config:
          - name: Ethernet1/6
            ipv4:
              - address: 192.168.1.1/24
                tag: 5
              - address: 10.1.1.1/24
                secondary: True
                tag: 10
            ipv6:
              - address: fd5d:12c9:2201:2::1/64
                tag: 6
        state: merged

    # After state:
    # ------------
    #
    # interface Ethernet1/6
    #   ip address 192.168.22.1/24 tag 5
    #   ip address 10.1.1.1/24 secondary tag 10
    # interfaqce Ethernet1/6
    #   ipv6 address fd5d:12c9:2201:2::1/64 tag 6

    # Using replaced

    # Before state:
    # -------------
    #
    # interface Ethernet1/6
    #   ip address 192.168.22.1/24
    #   ipv6 address "fd5d:12c9:2201:1::1/64"

    - name: Replace device configuration of specified L3 interfaces with provided configuration.
      nxos_l3_interfaces:
        config:
          - name: Ethernet1/6
            ipv4: 192.168.22.3/24
        state: replaced

    # After state:
    # ------------
    #
    # interface Ethernet1/6
    #   ip address 192.168.22.3/24

    # Using overridden

    # Before state:
    # -------------
    #
    # interface Ethernet1/2
    #   ip address 192.168.22.1/24
    # interface Ethernet1/6
    #   ipv6 address "fd5d:12c9:2201:1::1/64"

    - name: Override device configuration of all L3 interfaces on device with provided configuration.
      nxos_l3_interfaces:
        config:
          - name: Ethernet1/2
            ipv4: 192.168.22.3/4
        state: overridden

    # After state:
    # ------------
    #
    # interface Ethernet1/2
    #   ipv4 address 192.168.22.3/24
    # interface Ethernet1/6

    # Using deleted

    # Before state:
    # -------------
    #
    # interface Ethernet1/6
    #   ip address 192.168.22.1/24
    # interface Ethernet1/2
    #   ipv6 address "fd5d:12c9:2201:1::1/64"

    - name: Delete L3 attributes of given interfaces (This won't delete the interface itself).
      nxos_l3_interfaces:
        config:
          - name: Ethernet1/6
          - name: Ethernet1/2
        state: deleted

    # After state:
    # ------------
    #
    # interface Ethernet1/6
    # interface Ethernet1/2

## 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.
commands list | always | The set of commands pushed to the remote device. Sample: ['interface Ethernet1/2', 'ip address 192.168.0.1/2']

## 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

- Trishna Guha (@trishnaguha)

Hint

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