ansible.netcommon.net_interface – (deprecated, removed after 2022-06-01) Manage Interface on network devices

Note

This plugin is part of the ansible.netcommon collection (version 2.5.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.net_interface.

New in version 1.0.0: of ansible.netcommon

DEPRECATED

Removed in

major release after 2022-06-01

Why

Updated modules released with more functionality

Alternative

Use platform-specific “[netos]_interfaces” module

Synopsis

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

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
aggregate
string
List of Interfaces definitions.
delay
string
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
string
Description of Interface.
duplex
string
    Choices:
  • full
  • half
  • auto ←
Interface link status
enabled
string
Configure interface link status.
mtu
string
Maximum size of transmit packet.
name
string / required
Name of the Interface.
purge
string
Default:
"no"
Purge Interfaces not defined in the aggregate parameter. This applies only for logical interface.
rx_rate
string
Receiver rate in bits per second (bps).
This is state check parameter only.
Supports conditionals, see Conditionals in Networking Modules
speed
string
Interface link speed.
state
string
    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
string
Transmit rate in bits per second (bps).
This is state check parameter only.
Supports conditionals, see Conditionals in Networking Modules

Notes

Note

Examples

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

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

- name: make interface up
  ansible.netcommon.net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: true

- name: make interface down
  ansible.netcommon.net_interface:
    name: ge-0/0/1
    description: test-interface
    enabled: false

- name: Create interface using aggregate
  ansible.netcommon.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
  ansible.netcommon.net_interface:
    aggregate:
    - {name: ge-0/0/1}
    - {name: ge-0/0/2}
    state: absent

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

- name: Config + intent
  ansible.netcommon.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 / elements=string
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

  • This module will be removed in a major release after 2022-06-01. [deprecated]

  • For more information see DEPRECATED.

Authors

  • Ganesh Nalawade (@ganeshrn)