Deprecated

Removed in 2.13

i

Reason:Updated modules released with more functionality | Alternative:Use platform-specific "[netos]_interfaces" module

ansible.builtin._net_interface (v2.9.17) — module

Manage Interface on network devices

| "added in version" 2.4 of ansible.builtin"

Authors: Ganesh Nalawade (@ganeshrn)

deprecated | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.17

Description

This module provides declarative management of Interfaces on network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure interface
  net_interface:
    name: ge-0/0/1
    description: test-interface
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove interface
  net_interface:
    name: ge-0/0/1
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: make interface up
  net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: True
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: make interface down
  net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create interface using aggregate
  net_interface:
    aggregate:
      - { name: ge-0/0/1, description: test-interface-1 }
      - { name: ge-0/0/2, description: test-interface-2 }
    speed: 1g
    duplex: full
    mtu: 512
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete interface using aggregate
  net_interface:
    aggregate:
      - { name: ge-0/0/1 }
      - { name: ge-0/0/2 }
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Check intent arguments
  net_interface:
    name: fxp0
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Config + intent
  net_interface:
    name: fxp0
    enabled: False
    state: down

Inputs

    
mtu:
    description:
    - Maximum size of transmit packet.

name:
    description:
    - Name of the Interface.
    required: true

delay:
    default: 10
    description:
    - Time in seconds to wait before checking for the operational state on remote device.
      This wait is applicable for operational state argument which are I(state) with values
      C(up)/C(down), I(tx_rate) and I(rx_rate).

purge:
    default: false
    description:
    - Purge Interfaces not defined in the aggregate parameter. This applies only for logical
      interface.

speed:
    description:
    - Interface link speed.

state:
    choices:
    - present
    - absent
    - up
    - down
    default: present
    description:
    - State of the Interface configuration, C(up) indicates present and operationally
      up and C(down) indicates present and operationally C(down)

duplex:
    choices:
    - full
    - half
    - auto
    default: auto
    description:
    - Interface link status

enabled:
    description:
    - Configure interface link status.

rx_rate:
    description:
    - Receiver rate in bits per second (bps).
    - This is state check parameter only.
    - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html)

tx_rate:
    description:
    - Transmit rate in bits per second (bps).
    - This is state check parameter only.
    - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html)

aggregate:
    description: List of Interfaces definitions.

description:
    description:
    - Description of Interface.

Outputs

commands:
  description: The list of configuration mode commands to send to the device.
  returned: always, except for the platforms that use Netconf transport to manage
    the device.
  sample:
  - interface 20
  - name test-interface
  type: list