PARALLAX

eos_l3_interfaces

L3 interfaces resource module

Collection: arista.eos

Full Name: arista.eos.eos_l3_interfaces

Controller module — runs on the local controller, not on remote hosts.

Synopsis

L3 interfaces resource module

Parameters

NameTypeRequiredDefaultDescription
configlist
running_configstr
statestrmerged

Example

yaml
# Using merged

# Before state:
# -------------
#
# test#show running-config | section interface
# interface Ethernet1
# !
# interface Ethernet2
#    description Configured by Ansible
#    shutdown
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

- name: Merge provided configuration with device configuration.
  arista.eos.eos_l3_interfaces:
    config:
      - name: Ethernet1
        ipv4:
          - address: 198.51.100.14/24
      - name: Ethernet2
        ipv4:
          - address: 203.0.113.27/24
    state: merged

# Task Output
# -----------
#
# before:
# - name: Ethernet1
# - name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1
# commands:
# - interface Ethernet1
# - ip address 198.51.100.14/24
# - interface Ethernet2
#   - ip address 203.0.113.27/24
# after:
# - ipv4:
#   - address: 198.51.100.14/24
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.27/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1

# After state:
# ------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ip address 198.51.100.14/24
# !
# interface Ethernet2
#    description Configured by Ansible
#    shutdown
#    ip address 203.0.113.27/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

# Using overridden

# Before state:
# -------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ip address 198.51.100.14/24
# !
# interface Ethernet2
#    ip address 203.0.113.27/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

- name: Override device configuration of all L2 interfaces on device with provided
    configuration.
  arista.eos.eos_l3_interfaces:
    config:
      - name: Ethernet1
        ipv6:
          - address: 2001:db8:feed::1/96
      - name: Ethernet2
        ipv4:
          - address: 203.0.113.27/24
      - ipv4:
          - address: dhcp
        name: Management1
    state: overridden

# Task Output
# -----------
#
# before:
# - ipv4:
#   - address: 198.51.100.14/24
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.27/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1
# commands:
# - interface Ethernet1
# - ipv6 address 2001:db8:feed::1/96
# - no ip address
# after:
# - ipv6:
#   - address: 2001:db8:feed::1/96
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.27/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1

# After state:
# ------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ipv6 address 2001:db8:feed::1/96
# !
# interface Ethernet2
#    ip address 203.0.113.27/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

# Using replaced

# Before state:
# -------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ipv6 address 2001:db8:feed::1/96
# !
# interface Ethernet2
#    ip address 203.0.113.27/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

- name: Replace device configuration of specified L2 interfaces with provided configuration.
  arista.eos.eos_l3_interfaces:
    config:
      - name: Ethernet2
        ipv4:
          - address: 203.0.113.27/24
    state: replaced

# Task Output
# -----------
#
# before:
# - ipv6:
#   - address: 2001:db8:feed::1/96
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.27/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1
# commands:
# - interface Ethernet2
# - ip address 203.0.113.28/24
# after:
# - ipv6:
#   - address: 2001:db8:feed::1/96
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.28/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1

# After state:
# ------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ipv6 address 2001:db8:feed::1/96
# !
# interface Ethernet2
#    ip address 203.0.113.28/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

# Using deleted

# Before state:
# -------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ipv6 address 2001:db8:feed::1/96
# !
# interface Ethernet2
#    ip address 203.0.113.28/24
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

- name: Delete L3 attributes of given interfaces.
  arista.eos.eos_l3_interfaces:
    config:
      - name: Ethernet1
      - name: Ethernet2
    state: deleted

# Task Output
# -----------
#
# before:
# - ipv6:
#   - address: 2001:db8:feed::1/96
#   name: Ethernet1
# - ipv4:
#   - address: 203.0.113.28/24
#   name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1
# commands:
# - interface Ethernet1
# - no ipv6 address 2001:db8:feed::1/96
# - interface Ethernet2
# - no ip address
# after:
# - name: Ethernet1
# - name: Ethernet2
# - ipv4:
#   - address: dhcp
#   name: Management1

# After state:
# ------------
#
# test#show running-config | section interface
# interface Ethernet1
# !
# interface Ethernet2
# !
# interface Management1
#    ip address dhcp
#    dhcp client accept default-route

# Using Parsed

# File: parsed.cfg
# ----------------
#
# veos#show running-config | section interface
# interface Ethernet1
#    ip address 198.51.100.14/24
# !
# interface Ethernet2
#    ip address 203.0.113.27/24
# !

- name: Use parsed to convert native configs to structured data
  arista.eos.interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Module Execution Result:
# ------------------------
#
# parsed:
#  - name: Ethernet1
#    ipv4:
#      - address: 198.51.100.14/24
#  - name: Ethernet2
#    ipv4:
#      - address: 203.0.113.27/24

# Using rendered:

- name: Use Rendered to convert the structured data to native config
  arista.eos.eos_l3_interfaces:
    config:
      - name: Ethernet1
        ipv4:
          - address: 198.51.100.14/24
      - name: Ethernet2
        ipv4:
          - address: 203.0.113.27/24
    state: rendered

# Module Execution Result:
# ------------------------
#
# rendered:
# - interface Ethernet1
# - ip address 198.51.100.14/24
# - interface Ethernet2
# - ip address 203.0.113.27/24

# using gathered:

# Before state:
# -------------
#
# test#show running-config | section interface
# interface Ethernet1
#    ip address 198.51.100.14/24
# !
# interface Ethernet2
#    ip address 203.0.113.27/24
# !

- name: Gather l3 interfaces facts from the device
  arista.eos.l3_interfaces:
    state: gathered

# Module Execution Result:
# ------------------------
#
# gathered:
#  - name: Ethernet1
#    ipv4:
#      - address: 198.51.100.14/24
#  - name: Ethernet2
#    ipv4:
#      - address: 203.0.113.27/24
Search
    ↑ ↓ move↵ openesc close