Note
This plugin is part of the dellemc.enterprise_sonic collection (version 1.1.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 dellemc.enterprise_sonic.
To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_l3_interfaces.
New in version 1.0.0: of dellemc.enterprise_sonic
Note
This module has a corresponding action plugin.
| Parameter | Choices/Defaults | Comments | |||
|---|---|---|---|---|---|
| config list / elements=dictionary | A list of l3_interfaces configurations. | ||||
| ipv4 dictionary | ipv4 configurations to be set for the Layer 3 interface mentioned in name option. | ||||
| addresses list / elements=dictionary | List of IPv4 addresses to be set. | ||||
| address string | IPv4 address to be set in the format <ipv4 address>/<mask> for example, 192.0.2.1/24. | ||||
| secondary boolean |
"False" | secondary flag of the ip address. | |||
| anycast_addresses list / elements=string | List of IPv4 addresses to be set for anycast. | ||||
| ipv6 dictionary | ipv6 configurations to be set for the Layer 3 interface mentioned in name option. | ||||
| addresses list / elements=dictionary | List of IPv6 addresses to be set. | ||||
| address string | IPv6 address to be set in the address format is <ipv6 address>/<mask> for example, 2001:db8:2201:1::1/64. | ||||
| enabled boolean |
| enabled flag of the ipv6. | |||
| name string / required | Full name of the interface, for example, Eth1/3. | ||||
| state string |
| The state that the configuration should be left in. | |||
Note
check_mode.# Using deleted
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ip address 92.1.1.1/16 secondary
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 11.12.13.14/12
# ip anycast-address 1.2.3.4/22
#!
#
#
- name: delete one l3 interface.
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
- name: Ethernet20
ipv4:
addresses:
- address: 83.1.1.1/16
- address: 84.1.1.1/16
- name: Ethernet24
ipv6:
enabled: true
addresses:
- address: 91::1/16
- name: Vlan501
ipv4:
anycast_addresses:
- 11.12.13.14/12
state: deleted
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ip address 92.1.1.1/16 secondary
# ipv6 address 90::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
#!
#
# Using deleted
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 11.12.13.14/12
# ip anycast-address 1.2.3.4/22
#!
#
#
- name: delete all l3 interface
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
state: deleted
#
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
#!
#interface Vlan501
#!
#
# Using merged
#
# Before state:
# -------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
#!
#
- name: Add l3 interface configurations
dellemc.enterprise_sonic.sonic_l3_interfaces:
config:
- name: Ethernet20
ipv4:
addresses:
- address: 83.1.1.1/16
- address: 84.1.1.1/16
secondary: True
ipv6:
enabled: true
addresses:
- address: 83::1/16
- address: 84::1/16
secondary: True
- name: Ethernet24
ipv4:
addresses:
- address: 91.1.1.1/16
ipv6:
addresses:
- address: 90::1/16
- address: 91::1/16
- address: 92::1/16
- address: 93::1/16
- name: Vlan501
ipv4:
anycast_addresses:
- 11.12.13.14/12
state: merged
#
# After state:
# ------------
#
#rno-dctor-1ar01c01sw02# show running-configuration interface
#!
#interface Ethernet20
# mtu 9100
# speed 100000
# shutdown
# ip address 83.1.1.1/16
# ip address 84.1.1.1/16 secondary
# ipv6 address 83::1/16
# ipv6 address 84::1/16
# ipv6 enable
#!
#interface Ethernet24
# mtu 9100
# speed 100000
# shutdown
# ip address 91.1.1.1/16
# ipv6 address 90::1/16
# ipv6 address 91::1/16
# ipv6 address 92::1/16
# ipv6 address 93::1/16
#!
#interface Vlan501
# ip anycast-address 1.2.3.4/22
# ip anycast-address 11.12.13.14/12
#!
#
#
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| after list / elements=string | when changed | The resulting configuration model invocation. Sample: The configuration returned is always in the same format of the parameters above. |
| before list / elements=string | always | The configuration prior to the model invocation. Sample: The configuration returned is always in the same format of the parameters above. |
| commands list / elements=string | always | The set of commands pushed to the remote device. Sample: ['command 1', 'command 2', 'command 3'] |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_l3_interfaces_module.html