net_interface – Manage Interface on network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of Interfaces on network devices.

Parameters

Parameter Choices/Defaults Comments
aggregate
-
List of Interfaces definitions.
delay
-
Default:
10
Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state argument which are state with values up/down, tx_rate and rx_rate.
description
-
Description of Interface.
duplex
-
    Choices:
  • full
  • half
  • auto ←
Interface link status
enabled
-
Configure interface link status.
mtu
-
Maximum size of transmit packet.
name
- / required
Name of the Interface.
purge
-
Default:
"no"
Purge Interfaces not defined in the aggregate parameter. This applies only for logical interface.
rx_rate
-
Receiver rate in bits per second (bps).
This is state check parameter only.
Supports conditionals, see Conditionals in Networking Modules
speed
-
Interface link speed.
state
-
    Choices:
  • present ←
  • absent
  • up
  • down
State of the Interface configuration, up indicates present and operationally up and down indicates present and operationally down
tx_rate
-
Transmit rate in bits per second (bps).
This is state check parameter only.
Supports conditionals, see Conditionals in Networking Modules

Examples

- name: configure interface
  net_interface:
    name: ge-0/0/1
    description: test-interface

- name: remove interface
  net_interface:
    name: ge-0/0/1
    state: absent

- name: make interface up
  net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: True

- name: make interface down
  net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: False

- 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

- name: Delete interface using aggregate
  junos_interface:
    aggregate:
      - { name: ge-0/0/1 }
      - { name: ge-0/0/2 }
    state: absent

- name: Check intent arguments
  net_interface:
    name: fxp0
    state: up
    tx_rate: ge(0)
    rx_rate: le(0)

- name: Config + intent
  net_interface:
    name: fxp0
    enabled: False
    state: down

Return Values

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

Key Returned Description
commands
list
always, except for the platforms that use Netconf transport to manage the device.
The list of configuration mode commands to send to the device.

Sample:
['interface 20', 'name test-interface']


Status

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.