-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathsub_main_ebgp_vxlan.yml
More file actions
306 lines (245 loc) · 14.6 KB
/
Copy pathsub_main_ebgp_vxlan.yml
File metadata and controls
306 lines (245 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# Copyright (c) 2025 Cisco Systems, Inc. and its affiliates
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# SPDX-License-Identifier: MIT
---
- name: Fail if Data Model is not defined
ansible.builtin.fail:
msg: "Service Model Not Defined. Role cisco.nac_dc_vxlan.validate Must Be Called First"
when: data_model is undefined
delegate_to: localhost
# ------------------------------------------------------------------------
# Remove all files from the previous run if run_map requires it
# ------------------------------------------------------------------------
- name: Set path_name Var
ansible.builtin.set_fact:
path_name: "{{ role_path }}/files/ebgp_vxlan/{{ data_model_extended.vxlan.fabric.name }}/"
delegate_to: localhost
- name: Cleanup Files from Previous Run if run_map requires it
ansible.builtin.import_tasks: cleanup_files.yml
when:
- not run_map_read_result.diff_run or ((force_run_all is defined) and (force_run_all is true|bool))
# --------------------------------------------------------------------
# Build Create eBGP VXLAN Fabric parameter List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Create Parameters
ansible.builtin.import_tasks: common/ndfc_fabric.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Switch Inventory List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Switch Inventory List From Template
ansible.builtin.import_tasks: common/ndfc_inventory.yml
# We need to also build an inventory list without bootstrap settings
# This will be used for device removal.
- name: Build eBGP VXLAN Fabric Switch Inventory List From Template - No Bootstrap
ansible.builtin.import_tasks: common/ndfc_inventory_no_bootstrap.yml
# --------------------------------------------------------------------
# Build vPC Domain ID Resource From Template
# --------------------------------------------------------------------
- name: Build vPC Domain ID Resource From Template
ansible.builtin.import_tasks: common/ndfc_vpc_domain_id_resource.yml
# --------------------------------------------------------------------
# Build vPC Intra Fabric Links for vPC Peering From Template
# --------------------------------------------------------------------
- name: Build vPC Intra Fabric Links From Template
ansible.builtin.import_tasks: common/ndfc_vpc_fabric_peering_links.yml
# --------------------------------------------------------------------
# Build vPC Peering parameter List From Template
# --------------------------------------------------------------------
- name: Build vPC Peering Parameters
ansible.builtin.import_tasks: common/ndfc_vpc_peering_pairs.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN ToR Pairing Payloads From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric ToR Pairing Payloads From Template
ansible.builtin.import_tasks: common/ndfc_tor_pairing.yml
# --------------------------------------------------------------------
# Build NDFC Fabric VRFs Attach List From Template
# --------------------------------------------------------------------
- name: Build NDFC Fabric VRFs Attach List From Template
ansible.builtin.import_tasks: vxlan/ndfc_vrfs.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Networks Attach List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Networks Attach List From Template
ansible.builtin.import_tasks: vxlan/ndfc_networks.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Breakout Interfaces List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Breakout Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_breakout.yml
# ------------------------------------------------------------------------
# Build iBGP VXLAN Fabric PreProv Breakout Interfaces List From Template
# ------------------------------------------------------------------------
- name: Build iBGP VXLAN Fabric Breakout PreProv Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_breakout_preprov.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Loopback Interfaces List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Loopback Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_loopback.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Access Port-Channel Interfaces List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Access Port-Channel Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_access_po.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Trunk Port-Channel Interfaces List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Trunk Port-Channel Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_trunk_po.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Interface Routed List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Interface Routed List From Template
ansible.builtin.import_tasks: common/ndfc_interface_routed.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Sub-Interface Routed List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Sub-Interface Routed List From Template
ansible.builtin.import_tasks: common/ndfc_sub_interface_routed.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Routed Port-Channel Interface List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Routed Port-Channel Interface List From Template
ansible.builtin.import_tasks: common/ndfc_interface_po_routed.yml
# --------------------------------------------------------------------
# Build Trunk Interfaces List From Template
# --------------------------------------------------------------------
- name: Build Trunk Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_trunk.yml
# --------------------------------------------------------------------
# Build Access Interfaces List From Template
# --------------------------------------------------------------------
- name: Build Access Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_access.yml
# --------------------------------------------------------------------
# Build Dot1q Interfaces List From Template
# --------------------------------------------------------------------
- name: Build Dot1q Interfaces List From Template
ansible.builtin.import_tasks: common/ndfc_interface_dot1q.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Interface vPC List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric interface vPC List From Template
ansible.builtin.import_tasks: common/ndfc_interface_vpc.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric interface all List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric interface All List From Template
ansible.builtin.import_tasks: common/ndfc_interface_all.yml
# --------------------------------------------------------------------
# Build eBGP VXLAN Fabric Policy List From Template
# --------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Policy List From Template
ansible.builtin.import_tasks: common/ndfc_policy.yml
# ------------------------------------------------------------------------
# Build eBGP VXLAN Fabric Underlay Resources List From Template
# ------------------------------------------------------------------------
- name: Build eBGP VXLAN Fabric Underlay Resources List From Template
ansible.builtin.import_tasks: common/ndfc_underlay_ip_address.yml
# # --------------------------------------------------------------------
# # Build eBGP VXLAN Fabric Links List From Template
# # --------------------------------------------------------------------
# - name: Build eBGP VXLAN Fabric Links List From Template
# ansible.builtin.import_tasks: common/ndfc_fabric_links.yml
# # --------------------------------------------------------------------
# # Build Edge Connections List From Template
# # --------------------------------------------------------------------
# - name: Edge Connections List From Template
# ansible.builtin.import_tasks: common/ndfc_edge_connections.yml
# --------------------------------------------------------------------
# Save Local Variables To NameSpace Dict For Use Elsewhere
# ------------------------------------------------------------------------
- name: Save Local Variables With Namespace Context
ansible.builtin.set_fact:
vars_common_ebgp_vxlan:
fabric_config: "{{ fabric_config }}"
# TODO: Why are these commented out (Here and above)?
# fabric_links: "{{ fabric_links }}"
interface_breakout: "{{ interface_breakout }}"
interface_breakout_preprov: "{{ interface_breakout_preprov }}"
# TODO: Why are these commented out (Here and above)?
# edge_connections: "{{ edge_connections }}"
interface_access_po: "{{ interface_access_po }}"
interface_access: "{{ interface_access }}"
interface_all_create: "{{ interface_all_create }}"
interface_all_remove_overridden: "{{ interface_all_remove_overridden }}"
int_loopback_config: "{{ int_loopback_config }}"
interface_po_routed: "{{ interface_po_routed }}"
interface_routed: "{{ interface_routed }}"
interface_trunk_po: "{{ interface_trunk_po }}"
interface_trunk: "{{ interface_trunk }}"
interface_vpc: "{{ interface_vpc }}"
interface_dot1q: "{{ interface_dot1q }}"
inv_config: "{{ inv_config }}"
link_vpc_peering: "{{ link_vpc_peering }}"
net_config: "{{ net_config }}"
tor_pairing: "{{ tor_pairing }}"
poap_data: "{{ poap_data }}"
policy_config: "{{ policy_config }}"
sub_interface_routed: "{{ sub_interface_routed }}"
updated_inv_config: "{{ updated_inv_config }}"
updated_inv_config_no_bootstrap: "{{ updated_inv_config_no_bootstrap }}"
vpc_peering: "{{ vpc_peering }}"
vpc_domain_id_resource: "{{ vpc_domain_id_resource }}"
vrf_config: "{{ vrf_config }}"
vrf_attach_config: "{{ vrf_attach_config }}"
underlay_ip_address: "{{ underlay_ip_address }}"
# Diff Result Data
interface_diff_result: "{{ interface_diff_result }}"
network_diff_result: "{{ network_diff_result }}"
tor_pairing_diff_result: "{{ tor_pairing_diff_result }}"
vpc_peering_diff_result: "{{ vpc_peering_diff_result }}"
vpc_domain_id_resource_diff_result: "{{ vpc_domain_id_resource_diff_result }}"
vrf_diff_result: "{{ vrf_diff_result }}"
underlay_ip_address_diff_result: "{{ underlay_ip_address_diff_result }}"
# --------------------------------------------------------------------
# We need to check if the current fabric is part of a Multisite fabric
# and stop execution if the data model for this fabric is attempting
# to manage VRFs or Networks
# --------------------------------------------------------------------
- name: Check If Current Fabric Is An Active Multisite Fabric in Nexus Dashboard
when: is_active_child_fabric is not defined
block:
- name: Get Multisite Fabric Associations in Nexus Dashboard
cisco.dcnm.dcnm_rest:
method: GET
path: /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations
register: ndfc_msd_fabric_associations
- name: Find Current Fabric by Name In Multisite Associations from Nexus Dashboard
ansible.builtin.set_fact:
selected_fabric: "{{ ndfc_msd_fabric_associations['response']['DATA'] | json_query(json_query) }}"
vars:
json_query: "[?fabricName=='{{ data_model_extended.vxlan.fabric.name }}']"
- name: Set Multisite Check for Current Fabric
ansible.builtin.set_fact:
is_active_child_fabric: "{{ true if (selected_fabric | length > 0 and selected_fabric[0]['fabricParent'] != 'None') else false }}"
- name: Fail If Current Fabric is Part of Multisite And Attempting to Manage VRFs
ansible.builtin.fail:
msg: VRFs cannot be managed from the current fabric {{ data_model_extended.vxlan.fabric.name }} as it is a child fabric part of a Multisite fabric.
when:
- is_active_child_fabric
- vars_common_ebgp_vxlan.vrf_config | length > 0
- name: Fail If Current Fabric is Part of Multisite And Attempting to Manage Networks
ansible.builtin.fail:
msg: Networks cannot be managed from the current fabric {{ data_model_extended.vxlan.fabric.name }} as it is a child fabric part of a Multisite fabric.
when:
- is_active_child_fabric
- vars_common_ebgp_vxlan.net_config | length > 0