nxos_ip_interface - Manages L3 attributes for IPv4 and IPv6 interfaces.

New in version 2.1.

DEPRECATED

Removed in Ansible:
version: 2.9
Why: Replaced with common *_l3_interface network modules.
Alternative: Use nxos_l3_interface instead.

Synopsis

  • Manages Layer 3 attributes for IPv4 and IPv6 interfaces.

Requirements

The below requirements are needed on the host that executes this module.

  • ipaddress

Parameters

Parameter Choices/Defaults Comments
addr Default:
None
IPv4 or IPv6 Address.
allow_secondary
(added in 2.4)
Default:
no
Allow to configure IPv4 secondary addresses on interface.
dot1q
(added in 2.5)
Default:
None
Configures IEEE 802.1Q VLAN encapsulation on the subinterface. The range is from 2 to 4093.
interface
required
Full name of interface, i.e. Ethernet1/1, vlan10.
mask Default:
None
Subnet mask for IPv4 or IPv6 Address in decimal format.
provider Default:
None
Deprecated
Starting with Ansible 2.5 we recommend using connection: network_cli.
This option is only required if you are using NX-API.
For more information please see the NXOS Platform Options guide.
A dict object containing connection details.
username
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate either the CLI login or the nxapi authentication depending on which transport is used. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
authorize
(added in 2.5.3)
    Choices:
  • no
  • yes
Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTHORIZE will be used instead.
ssh_keyfile
Specifies the SSH key to use to authenticate the connection to the remote device. This argument is only used for the cli transport. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
use_proxy
(added in 2.5)
    Choices:
  • yes
  • no
If no, the environment variables http_proxy and https_proxy will be ignored.
auth_pass
(added in 2.5.3)
Default:
none
Specifies the password to use if required to enter privileged mode on the remote device. If authorize is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_AUTH_PASS will be used instead.
host
required
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
timeout
(added in 2.3)
Default:
10
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. NX-API can be slow to return on long-running commands (sh mac, sh bgp, etc).
use_ssl
    Choices:
  • yes
  • no
Configures the transport to use SSL if set to true only when the transport=nxapi, otherwise this value is ignored.
password Default:
None
Specifies the password to use to authenticate the connection to the remote device. This is a common argument used for either cli or nxapi transports. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
validate_certs
    Choices:
  • yes
  • no
Default:
None
If no, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If the transport argument is not nxapi, this value is ignored.
port Default:
0 (use common port)
Specifies the port to use when building the connection to the remote device. This value applies to either cli or nxapi. The port value will default to the appropriate transport common port if none is provided in the task. (cli=22, http=80, https=443).
transport
required
Default:
cli
Configures the transport connection to use when connecting to the remote device. The transport argument supports connectivity to the device over cli (ssh) or nxapi.
state
    Choices:
  • present
  • absent
Specify desired state of the resource.
tag
(added in 2.4)
Default:
0
Route tag for IPv4 or IPv6 Address in integer format.
version
    Choices:
  • v4
  • v6
Version of IP address. If the IP address is IPV4 version should be v4. If the IP address is IPV6 version should be v6.

Notes

Note

  • Tested against NXOSv 7.3.(0)D1(1) on VIRL
  • Interface must already be a L3 port when using this module.
  • Logical interfaces (po, loop, svi) must be created first.
  • mask must be inserted in decimal format (i.e. 24) for both IPv6 and IPv4.
  • A single interface can have multiple IPv6 configured.
  • tag is not idempotent for IPv6 addresses and I2 system image.
  • For information on using CLI and NX-API see the NXOS Platform Options guide
  • For more information on using Ansible to manage network devices see the Ansible Network Guide
  • For more information on using Ansible to manage Cisco devices see the Cisco integration page.

Examples

- name: Ensure ipv4 address is configured on Ethernet1/32
  nxos_ip_interface:
    interface: Ethernet1/32
    transport: nxapi
    version: v4
    state: present
    addr: 20.20.20.20
    mask: 24

- name: Ensure ipv6 address is configured on Ethernet1/31
  nxos_ip_interface:
    interface: Ethernet1/31
    transport: cli
    version: v6
    state: present
    addr: '2001::db8:800:200c:cccb'
    mask: 64

- name: Ensure ipv4 address is configured with tag
  nxos_ip_interface:
    interface: Ethernet1/32
    transport: nxapi
    version: v4
    state: present
    tag: 100
    addr: 20.20.20.20
    mask: 24

- name: Ensure ipv4 address is configured on sub-intf with dot1q encapsulation
  nxos_ip_interface:
    interface: Ethernet1/32.10
    transport: nxapi
    version: v4
    state: present
    dot1q: 10
    addr: 20.20.20.20
    mask: 24

- name: Configure ipv4 address as secondary if needed
  nxos_ip_interface:
    interface: Ethernet1/32
    transport: nxapi
    version: v4
    state: present
    allow_secondary: true
    addr: 21.21.21.21
    mask: 24

Return Values

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

Key Returned Description
changed
boolean
always
check to see if a change was made on the device

Sample:
True
commands
list
always
commands sent to the device

Sample:
['interface ethernet1/32', 'ip address 20.20.20.20/24 secondary tag 100']
end_state
dict
always
k/v pairs of IP attributes after module execution

Sample:
{'interface': 'ethernet1/32', 'prefixes': ['11.11.0.0/17', '20.20.20.0/24'], 'type': 'ethernet', 'addresses': [{'tag': 101, 'mask': 17, 'addr': '11.11.11.11', 'secondary': False}, {'tag': 100, 'mask': 24, 'addr': '20.20.20.20', 'secondary': True}], 'vrf': 'default'}
existing
dict
always
k/v pairs of existing IP attributes on the interface

Sample:
{'interface': 'ethernet1/32', 'prefixes': ['11.11.0.0/17'], 'type': 'ethernet', 'addresses': [{'tag': 101, 'mask': 17, 'addr': '11.11.11.11', 'secondary': False}], 'vrf': 'default'}
proposed
dict
always
k/v pairs of parameters passed into module

Sample:
{'interface': 'Ethernet1/32', 'allow_secondary': True, 'mask': '24', 'addr': '20.20.20.20', 'tag': 100}


Status

This module is flagged as deprecated and will be removed in version 2.9. For more information see DEPRECATED.

Author

  • Jason Edelman (@jedelman8)
  • Gabriele Gerbino (@GGabriele)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/nxos_ip_interface_module.html