dellemc / dellemc.enterprise_sonic / 2.4.0 / module / sonic_prefix_lists prefix list configuration handling for SONiC | "added in version" 2.0.0 of dellemc.enterprise_sonic" Authors: Kerry Meyer (@kerry-meyer)dellemc.enterprise_sonic.sonic_prefix_lists (2.4.0) — module
Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0
collections: - name: dellemc.enterprise_sonic version: 2.4.0
This module provides configuration management for prefix list parameters on devices running SONiC.
# Using "merged" state to create initial configuration # # Before state: # ------------- # # sonic# show running-configuration ip prefix-list # sonic# # (No configuration present) # # ------------- # - name: Merge initial prefix-list configuration dellemc.enterprise_sonic.sonic_prefix_lists: config: - name: pfx1 afi: "ipv4" prefixes: - sequence: 10 prefix: "1.2.3.4/24" action: "permit" ge: 26 le: 30 state: merged
# After state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 10 permit 1.2.3.4/24 ge 26 le 30 # ------------ # # *************************************************************** # Using "merged" state to update and add configuration # # Before state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 10 permit 1.2.3.4/24 ge 26 le 30 # # sonic# show running-configuration ipv6 prefix-list # sonic# # (no IPv6 prefix-list configuration present) # # ------------ # - name: Merge additional prefix-list configuration dellemc.enterprise_sonic.sonic_prefix_lists: config: - name: pfx1 afi: "ipv4" prefixes: - sequence: 20 action: "deny" prefix: "1.2.3.12/26" - sequence: 30 action: "permit" prefix: "7.8.9.0/24" - name: pfx6 afi: "ipv6" prefixes: - sequence: 25 action: "permit" prefix: "40::300/124" state: merged
# After state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 10 permit 1.2.3.4/24 ge 26 le 30 # ip prefix-list pfx1 seq 20 deny 1.2.3.12/26 # ip prefix-list pfx1 seq 30 permit 7.8.9.0/24 # # sonic# show running-configuration ipv6 prefix-list # ! # ipv6 prefix-list pfx6 seq 25 permit 40::300/124 # # *************************************************************** # Using "deleted" state to remove configuration # # Before state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 10 permit 1.2.3.4/24 ge 26 le 30 # ip prefix-list pfx1 seq 20 deny 1.2.3.12/26 # ip prefix-list pfx1 seq 30 permit 7.8.9.0/24 # # sonic# show running-configuration ipv6 prefix-list # ! # ipv6 prefix-list pfx6 seq 25 permit 40::300/124 # # ------------ # - name: Delete selected prefix-list configuration dellemc.enterprise_sonic.sonic_prefix_lists: config: - name: pfx1 afi: "ipv4" prefixes: - sequence: 10 prefix: "1.2.3.4/24" action: "permit" ge: 26 le: 30 - sequence: 20 action: "deny" prefix: "1.2.3.12/26" - name: pfx6 afi: "ipv6" prefixes: - sequence: 25 action: "permit" prefix: "40::300/124" state: deleted
# After state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 30 permit 7.8.9.0/24 # # sonic# show running-configuration ipv6 prefix-list # sonic# # (no IPv6 prefix-list configuration present) # # *************************************************************** # Using "overriden" state to override configuration # # Before state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx1 seq 10 permit 1.2.3.4/24 ge 26 le 30 # ip prefix-list pfx3 seq 20 deny 1.2.3.12/26 # ip prefix-list pfx4 seq 30 permit 7.8.9.0/24 # # sonic# show running-configuration ipv6 prefix-list # ! # ipv6 prefix-list pfx6 seq 25 permit 40::300/124 # # ------------ # - name: Override prefix-list configuration dellemc.enterprise_sonic.sonic_prefix_lists: config: - name: pfx2 afi: "ipv4" prefixes: - sequence: 10 prefix: "10.20.30.128/24" action: "deny" ge: 25 le: 30 state: overridden
# After state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx2 seq 10 deny 10.20.30.128/24 ge 25 le 30 # # sonic# show running-configuration ipv6 prefix-list # sonic# # (no IPv6 prefix-list configuration present) # # *************************************************************** # Using "replaced" state to replace configuration # # Before state: # ------------ # # sonic# show running-configuration ip prefix-list # ! # ip prefix-list pfx2 seq 10 deny 10.20.30.128/24 ge 25 le 30 # # sonic# show running-configuration ipv6 prefix-list # sonic# # (no IPv6 prefix-list configuration present) # # ------------ # - name: Replace prefix-list configuration dellemc.enterprise_sonic.sonic_prefix_lists: config: - name: pfx2 afi: "ipv4" prefixes: - sequence: 10 prefix: "10.20.30.128/24" action: "permit" ge: 25 le: 30 - name: pfx3 afi: "ipv6" prefixes: - sequence: 20 action: "deny" prefix: "60::70/124" state: replaced
state: choices: - merged - deleted - replaced - overridden default: merged description: - Specifies the type of configuration update to be performed on the device. - For "merged", merge specified attributes with existing configured attributes. - For "deleted", delete the specified attributes from existing configuration. - For "replaced", replace the specified existing configuration with the provided configuration. - For "overridden", override the existing configuration with the provided configuration. type: str config: description: - Specifies a list of prefix set configuration dictionaries elements: dict suboptions: afi: choices: - ipv4 - ipv6 default: ipv4 description: - Specifies the Address Family for addresses in the prefix list entries type: str name: description: - Name of a prefix set (a list of prefix entries) required: true type: str prefixes: description: - A list of prefix entries elements: dict suboptions: action: choices: - permit - deny description: - Action to be taken for addresses matching this prefix entry required: true type: str ge: description: Minimum prefix length to be matched type: int le: description: Maximum prefix length to be matched type: int prefix: description: - IPv4 or IPv6 prefix in A.B.C.D/LEN or A:B::C:D/LEN format required: true type: str sequence: description: - Precedence for this prefix entry (unique within the prefix list) required: true type: int type: list type: list
after: description: The resulting configuration model invocation. returned: when changed sample: '' type: list before: description: The configuration prior to the model invocation. returned: always sample: '' type: list commands: description: The set of commands pushed to the remote device. returned: always sample: null type: list