-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor for sharing code and simplification
- Loading branch information
Showing
60 changed files
with
2,557 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) 2024 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: Initialize changes_detected Var | ||
ansible.builtin.set_fact: | ||
changes_detected_fabric: false | ||
delegate_to: localhost | ||
|
||
- name: Set file_name Var | ||
ansible.builtin.set_fact: | ||
file_name: "ndfc_fabric.yml" | ||
delegate_to: localhost | ||
|
||
- name: Stat Previous File If It Exists | ||
ansible.builtin.stat: | ||
path: "{{ path_name }}{{ file_name }}" | ||
register: data_file_previous | ||
delegate_to: localhost | ||
# TODO: Add capability to overridde path variable above for CI/CD pipeline | ||
|
||
- name: Backup Previous Data File If It Exists | ||
ansible.builtin.copy: | ||
src: "{{ path_name }}{{ file_name }}" | ||
dest: "{{ path_name }}{{ file_name }}.old" | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Delete Previous Data File If It Exists | ||
ansible.builtin.file: | ||
state: absent | ||
path: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Build Fabric Creation Parameters From Template | ||
ansible.builtin.template: | ||
src: ndfc_fabric.j2 | ||
dest: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
|
||
- ansible.builtin.set_fact: | ||
fabric_config: "{{ lookup('file', path_name + file_name) | from_yaml }}" | ||
delegate_to: localhost | ||
|
||
- name: Diff Previous and Current Data Files | ||
cisco.nac_dc_vxlan.dtc.diff_model_changes: | ||
file_name_previous: "{{ path_name }}{{ file_name }}.old" | ||
file_name_current: "{{ path_name }}{{ file_name }}" | ||
register: file_diff_result | ||
delegate_to: localhost | ||
|
||
- name: Set File Change Flag Based on File Diff Result | ||
ansible.builtin.set_fact: | ||
changes_detected_fabric: true | ||
delegate_to: localhost | ||
when: | ||
- file_diff_result.file_data_changed | ||
- check_roles['save_previous'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright (c) 2024 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: Initialize changes_detected Var | ||
ansible.builtin.set_fact: | ||
changes_detected_fabric_links: false | ||
delegate_to: localhost | ||
|
||
- name: Set file_name Var | ||
ansible.builtin.set_fact: | ||
file_name: "ndfc_fabric_links.yml" | ||
delegate_to: localhost | ||
|
||
- name: Stat Previous File If It Exists | ||
ansible.builtin.stat: | ||
path: "{{ path_name }}{{ file_name }}" | ||
register: data_file_previous | ||
delegate_to: localhost | ||
|
||
- name: Backup Previous Data File If It Exists | ||
ansible.builtin.copy: | ||
src: "{{ path_name }}{{ file_name }}" | ||
dest: "{{ path_name }}{{ file_name }}.old" | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Delete Previous Data File If It Exists | ||
ansible.builtin.file: | ||
state: absent | ||
path: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Build Fabric Links | ||
ansible.builtin.template: | ||
src: ndfc_fabric_links.j2 | ||
dest: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
|
||
- name: Set fabric_links Var default | ||
ansible.builtin.set_fact: | ||
fabric_links: [] | ||
delegate_to: localhost | ||
|
||
- name: Set fabric_links Var | ||
ansible.builtin.set_fact: | ||
fabric_links: "{{ lookup('file', path_name + file_name) | from_yaml }}" | ||
when: MD_Extended.vxlan.topology.fabric_links | length > 0 | ||
delegate_to: localhost | ||
|
||
- name: Diff Previous and Current Data Files | ||
cisco.nac_dc_vxlan.dtc.diff_model_changes: | ||
file_name_previous: "{{ path_name }}{{ file_name }}.old" | ||
file_name_current: "{{ path_name }}{{ file_name }}" | ||
register: file_diff_result | ||
delegate_to: localhost | ||
|
||
- name: Set File Change Flag Based on File Diff Result | ||
ansible.builtin.set_fact: | ||
changes_detected_fabric_links: true | ||
delegate_to: localhost | ||
when: | ||
- file_diff_result.file_data_changed | ||
- check_roles['save_previous'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Copyright (c) 2024 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: Initialize changes_detected Var | ||
ansible.builtin.set_fact: | ||
changes_detected_interface_access: false | ||
delegate_to: localhost | ||
|
||
- name: Set file_name Var | ||
ansible.builtin.set_fact: | ||
file_name: "ndfc_interface_access.yml" | ||
delegate_to: localhost | ||
|
||
- name: Stat Previous File If It Exists | ||
ansible.builtin.stat: | ||
path: "{{ path_name }}{{ file_name }}" | ||
register: data_file_previous | ||
delegate_to: localhost | ||
|
||
- name: Backup Previous Data File If It Exists | ||
ansible.builtin.copy: | ||
src: "{{ path_name }}{{ file_name }}" | ||
dest: "{{ path_name }}{{ file_name }}.old" | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Delete Previous Data File If It Exists | ||
ansible.builtin.file: | ||
state: absent | ||
path: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
when: data_file_previous.stat.exists | ||
|
||
- name: Build Interface | ||
ansible.builtin.template: | ||
src: ndfc_interfaces/ndfc_interface_access.j2 | ||
dest: "{{ path_name }}{{ file_name }}" | ||
delegate_to: localhost | ||
|
||
- name: Set interface_access Var | ||
ansible.builtin.set_fact: | ||
interface_access: [] | ||
delegate_to: localhost | ||
|
||
- name: Set interface_access Var | ||
ansible.builtin.set_fact: | ||
interface_access: "{{ lookup('file', path_name + file_name) | from_yaml }}" | ||
when: MD_Extended.vxlan.topology.interfaces.modes.access.count > 0 | ||
delegate_to: localhost | ||
|
||
- name: Diff Previous and Current Data Files | ||
cisco.nac_dc_vxlan.dtc.diff_model_changes: | ||
file_name_previous: "{{ path_name }}{{ file_name }}.old" | ||
file_name_current: "{{ path_name }}{{ file_name }}" | ||
register: file_diff_result | ||
delegate_to: localhost | ||
|
||
- name: Set File Change Flag Based on File Diff Result | ||
ansible.builtin.set_fact: | ||
changes_detected_interface_access: true | ||
delegate_to: localhost | ||
when: | ||
- file_diff_result.file_data_changed | ||
- check_roles['save_previous'] |
Oops, something went wrong.