Managing route_maps: and prefix_lists: #2241
-
I am struggling to understand the best way to handle route_maps:
RM-TEST-1:
sequence_numbers:
10:
type: permit
match: [ 'ip address prefix-list PL-TEST-1' ] at various levels in my ansible hostname-m debug -a "var=hostvars[inventory_hostname]" I can see that the route_maps dict is present in hostvars if defined at some levels like the top level fabric.yml or a host specific one, but it never seems to make it into the config. It also seems that if I define route_maps in several places, they are over written not merged. It was suggested that I use: What are the best practice recommendations to manage route_maps and prefix_lists in AVD in a scalable way? or at least, how do others manage them? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@rich9474 - Thanks for your patience; we missed this question! When you leverage the same key If you are leveraging eos_designs, you can leverage custom_structured_configuration, with a custom prefix for each level to achieve a merge of configuration. For example: # define custom structured configuration prefix for each level in your top-level variable.
custom_structured_configuration_prefix:
- custom_config_global_
- custom_config_groupA_
- custom_config_groupX_
- custom_config_host_
- custom_structured_configuration_ # keep default if already in use...
# In top-level group var i.e group_vars/fabric.yaml
custom_config_global_route_maps:
# In sub group var i.e group_vars/l3leaf.yaml
custom_config_groupA_route_maps:
# In hostvars var i.e host_vars/leaf1.yaml
custom_config_host_route_maps: Configuration for all 3 levels will then be merged and you can share common configurations in various group vars. If you have any further questions or require a live session to review this, please don't hesitate to contact us at [email protected]. |
Beta Was this translation helpful? Give feedback.
@rich9474 - Thanks for your patience; we missed this question!
When you leverage the same key
route_maps
at various levels, you are subject to Ansible variable precedence rules, and the variable closest to the host will win -> https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable.If you are leveraging eos_designs, you can leverage custom_structured_configuration, with a custom prefix for each level to achieve a merge of configuration.
For example: