Note
This plugin is part of the ansible.netcommon collection.
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
major release after 2022-06-01
Updated modules released with more functionality
Use platform-specific “[netos]_interfaces” module
Note
This module has a corresponding action plugin.
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 |
| 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 |
| 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
|
Note
ansible_network_os
network platforms. See the Network Platform Options for details.- 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
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'] |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/netcommon/net_interface_module.html