arista.eos.eos_prefix_lists 模块 – 管理前缀列表资源模块
注意
此模块是 arista.eos 集合 (版本 10.0.1) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install arista.eos
。
要在 playbook 中使用它,请指定: arista.eos.eos_prefix_lists
。
arista.eos 2.2.0 中的新增功能
概要
此模块配置和管理 Arista EOS 平台上前缀列表的属性。
参数
参数 |
注释 |
---|---|
前缀列表选项的字典列表 |
|
前缀列表的地址族指示器 (AFI)。 选项
|
|
前缀列表列表。 |
|
前缀列表列表 |
|
对指定路径执行的操作 选项
|
|
前缀掩码或地址掩码长度格式的 IPv4/v6 地址 |
|
匹配掩码长度 |
|
掩码长度。 |
|
等于/大于/小于 选项
|
|
重新排序列表。 |
|
使用默认值 (10) 重新排序。 选项
|
|
起始序列号。 |
|
递增序列号的步长。 |
|
序列号 |
|
前缀列表的名称 |
|
此选项仅与状态 *parsed* 一起使用。 此选项的值应是从 EOS 设备通过执行命令 **show running-config | section access-list** 收到的输出。 状态 *parsed* 从 |
|
配置应保留的状态。 选项
|
注释
注意
在 Arista EOS 4.24.6F 上测试过
此模块与连接
network_cli
一起使用。请参阅 EOS 平台选项。
示例
# Using merged
# Before state
# veos#show running-config | section prefix-lists
# veos#
- name: Merge provided configuration with device configuration
arista.eos.eos_prefix_lists:
config:
- afi: "ipv4"
prefix_lists:
- name: "v401"
entries:
- sequence: 25
action: "deny"
address: "45.55.4.0/24"
- sequence: 100
action: "permit"
address: "11.11.2.0/24"
match:
masklen: 32
operator: "ge"
- name: "v402"
entries:
- action: "deny"
address: "10.1.1.0/24"
sequence: 10
match:
masklen: 32
operator: "ge"
- afi: "ipv6"
prefix_lists:
- name: "v601"
entries:
- sequence: 125
action: "deny"
address: "5000:1::/64"
# Task Output
# -------------
# before: {}
# commands:
# - ipv6 prefix-list v601
# - seq 125 deny 5000:1::/64
# - ip prefix-list v401
# - seq 25 deny 45.55.4.0/24
# - seq 100 permit 11.11.2.0/24 ge 32
# - ip prefix-list v402
# - seq 10 deny 10.1.1.0/24 ge 32
# after:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# After state:
# ------------
# veos#
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24
# seq 100 permit 11.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
# Using merged:
# Failure scenario : 'merged' should not be used when an existing prefix-list (sequence number)
# is to be modified.
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24
# seq 100 permit 11.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
- name: Merge provided configuration with device configuration
arista.eos.eos_prefix_lists:
config:
- afi: "ipv4"
prefix_lists:
- name: "v401"
entries:
- sequence: 25
action: "deny"
address: "45.55.4.0/24"
match:
masklen: 32
operator: "ge"
- sequence: 100
action: "permit"
address: "11.11.2.0/24"
match:
masklen: 32
operator: "ge"
- name: "v402"
entries:
- action: "deny"
address: "10.1.1.0/24"
sequence: 10
match:
masklen: 32
operator: "ge"
- afi: "ipv6"
prefix_lists:
- name: "v601"
entries:
- sequence: 125
action: "deny"
address: "5000:1::/64"
state: merged
# Task Output
# -------------
# changed: false
# invocation:
# module_args:
# config:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# resequence:
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# resequence:
# sequence: 100
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# resequence:
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# match:
# resequence:
# sequence: 125
# name: v601
# running_config:
# state: merged
# msg: Sequence number 25 is already present. Use replaced/overridden operation to change
# the configuration
# Using Replaced:
# Before state:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24
# seq 100 permit 11.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
- name: Replace Provided configuration with given configuration
arista.eos.eos_prefix_lists:
config:
- afi: "ipv4"
prefix_lists:
- name: "v401"
entries:
- sequence: 25
action: "deny"
address: "45.55.4.0/24"
match:
masklen: 32
operator: "ge"
- sequence: 200
action: "permit"
address: "200.11.2.0/24"
match:
masklen: 32
operator: "ge"
state: replaced
# Task Output
# -------------
# before:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# commands:
# - ip prefix-list v401
# - no seq 25
# - seq 25 deny 45.55.4.0/24 ge 32
# - seq 200 permit 200.11.2.0/24 ge 32
# - no seq 100
# - no ip prefix-list v402
# after:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 200.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 200
# name: v401
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# After State:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 200 permit 200.11.2.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
#
#
# Using overridden:
# Before State:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 100 permit 11.11.2.0/24 ge 32
# seq 200 permit 200.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
- name: Override
arista.eos.eos_prefix_lists:
config:
- afi: "ipv4"
prefix_lists:
- name: "v401"
entries:
- sequence: 25
action: "deny"
address: "45.55.4.0/24"
- sequence: 300
action: "permit"
address: "30.11.2.0/24"
match:
masklen: 32
operator: "ge"
- name: "v403"
entries:
- action: "deny"
address: "10.1.1.0/24"
sequence: 10
state: overridden
# Task Output
# -------------
# before:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# - action: permit
# address: 200.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 200
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# commands:
# - no ipv6 prefix-list v601
# - ip prefix-list v401
# - seq 25 deny 45.55.4.0/24
# - seq 300 permit 30.11.2.0/24 ge 32
# - no seq 100
# - no seq 200
# - ip prefix-list v403
# - seq 10 deny 10.1.1.0/24
# - no ip prefix-list v402
# after:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 30.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 300
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# sequence: 10
# name: v403
# After State
# veos#
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 300 permit 30.11.2.0/24 ge 32
# !
# ip prefix-list v403
# seq 10 deny 10.1.1.0/24
# veos#
# Using deleted:
# Before State:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 100 permit 11.11.2.0/24 ge 32
# seq 300 permit 30.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ip prefix-list v403
# seq 10 deny 10.1.1.0/24
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
- name: Delete device configuration
arista.eos.eos_prefix_lists:
config:
- afi: "ipv6"
state: deleted
# Task Output
# -------------
# before:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# - action: permit
# address: 30.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 300
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - entries:
# - action: deny
# address: 10.1.1.0/24
# sequence: 10
# name: v403
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# commands:
# - no ipv6 prefix-list v601
# after:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# - action: permit
# address: 30.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 300
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - entries:
# - action: deny
# address: 10.1.1.0/24
# sequence: 10
# name: v403
# after State:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 100 permit 11.11.2.0/24 ge 32
# seq 300 permit 30.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ip prefix-list v403
# seq 10 deny 10.1.1.0/24
#
# Using deleted
# Before state:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24 ge 32
# seq 100 permit 11.11.2.0/24 ge 32
# seq 300 permit 30.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ip prefix-list v403
# seq 10 deny 10.1.1.0/24
# veos#
- name: Delete device configuration
arista.eos.eos_prefix_lists:
state: deleted
# Task Output
# -------------
# before:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# - action: permit
# address: 30.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 300
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - entries:
# - action: deny
# address: 10.1.1.0/24
# sequence: 10
# name: v403
# commands:
# - no ip prefix-list v401
# - no ip prefix-list v402
# - no ip prefix-list v403
# after: {}
# After State:
# veos#show running-config | section prefix-list
# veos#
# Using parsed:
# parse_prefix_lists.cfg
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24
# seq 100 permit 11.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
#
- name: parse configs
arista.eos.eos_prefix_lists:
running_config: "{{ lookup('file', './parsed_prefix_lists.cfg') }}"
state: parsed
# Task Output
# -------------
# parsed:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
# Using rendered:
- name: Render provided configuration
arista.eos.eos_prefix_lists:
config:
- afi: "ipv4"
prefix_lists:
- name: "v401"
entries:
- sequence: 25
action: "deny"
address: "45.55.4.0/24"
- sequence: 200
action: "permit"
address: "200.11.2.0/24"
match:
masklen: 32
operator: "ge"
- name: "v403"
entries:
- action: "deny"
address: "10.1.1.0/24"
sequence: 10
state: rendered
# Task Output
# -------------
# rendered:
# - ip prefix-list v401
# - seq 25 deny 45.55.4.0/24
# - seq 200 permit 200.11.2.0/24 ge 32
# - ip prefix-list v403
# - seq 10 deny 10.1.1.0/24
# using gathered:
# Device config:
# veos#show running-config | section prefix-list
# ip prefix-list v401
# seq 25 deny 45.55.4.0/24
# seq 100 permit 11.11.2.0/24 ge 32
# !
# ip prefix-list v402
# seq 10 deny 10.1.1.0/24 ge 32
# !
# ipv6 prefix-list v601
# seq 125 deny 5000:1::/64
# veos#
- name: gather configs
arista.eos.eos_prefix_lists:
state: gathered
# Task Output
# -------------
# gathered:
# - afi: ipv4
# prefix_lists:
# - entries:
# - action: deny
# address: 45.55.4.0/24
# sequence: 25
# - action: permit
# address: 11.11.2.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 100
# name: v401
# - entries:
# - action: deny
# address: 10.1.1.0/24
# match:
# masklen: 32
# operator: ge
# sequence: 10
# name: v402
# - afi: ipv6
# prefix_lists:
# - entries:
# - action: deny
# address: 5000:1::/64
# sequence: 125
# name: v601
返回值
公共返回值已记录在 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
生成的配置模型调用。 返回:发生更改时 示例: |
|
模型调用之前的配置。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |
|
从远程主机获取的运行配置转换后的结构化数据配置 返回:当 示例: |
|
将配置作为结构化数据转换,用于 返回:当 示例: |
|
根据 返回:当 示例: |