You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to maintain two separate YAML files for different link definitions — for example, one for “Connected Endpoints” and another for “Essential Links.” Ultimately, I need to feed all of these links into the same l3_edge structure that the AVD solution expects.
Instead, I want to merge both sets of link data into a single variable (l3_edge) at runtime using Ansible’s variable-merging capabilities. The challenge is that we have list data (e.g., p2p_links), which typically gets overwritten rather than merged unless extra steps are taken.
Below is a simplified, anonymized example to illustrate what I mean:
Question:
How can I cleanly merge these two separate YAML structures into one l3_edge variable without modifying any of the AVD Jinja templates?
Are there recommended best practices for list merging in Ansible (e.g., using combine, list_merge='append', etc.) to handle this scenario?
Are there any pitfalls I should watch out for when managing separate files at the group_vars level and merging them in a “final” file (e.g., group_vars/all)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello AVD community,
I would like to maintain two separate YAML files for different link definitions — for example, one for “Connected Endpoints” and another for “Essential Links.” Ultimately, I need to feed all of these links into the same l3_edge structure that the AVD solution expects.
Instead, I want to merge both sets of link data into a single variable (l3_edge) at runtime using Ansible’s variable-merging capabilities. The challenge is that we have list data (e.g., p2p_links), which typically gets overwritten rather than merged unless extra steps are taken.
Below is a simplified, anonymized example to illustrate what I mean:
Finally, I would like to produce a combined l3_edge variable that includes both sets of data, for example:
Question:
How can I cleanly merge these two separate YAML structures into one l3_edge variable without modifying any of the AVD Jinja templates?
Are there recommended best practices for list merging in Ansible (e.g., using combine, list_merge='append', etc.) to handle this scenario?
Are there any pitfalls I should watch out for when managing separate files at the group_vars level and merging them in a “final” file (e.g., group_vars/all)?
Beta Was this translation helpful? Give feedback.
All reactions