W3cubDocs

/Ansible

net_interface - Manage Interface on network devices

New in version 2.4.

Synopsis

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

Options

parameter required default choices comments
aggregate
no
List of Interfaces definitions.
delay
no 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
no
Description of Interface.
duplex
no auto
  • full
  • half
  • auto
Interface link status
enabled
no
Configure interface link status.
mtu
no
Maximum size of transmit packet.
name
yes
Name of the Interface.
purge
no
Purge Interfaces not defined in the aggregate parameter. This applies only for logical interface.
rx_rate
no
Receiver rate in bits per second (bps).
speed
no
Interface link speed.
state
no present
  • present
  • absent
  • up
  • down
State of the Interface configuration, up indicates present and operationally up and down indicates present and operationally down
tx_rate
no
Transmit rate in bits per second (bps).

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 Return Values, the following are the fields unique to this module:

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

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/net_interface_module.html