-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include latest changes for templates and backup and restore (#17)
* add playbooks for backup & restore device templates with policies * include security changes for scorecard * bump setuptools for security scorecard * mark false positives for secret * playbooks for running config b&r * ansible lint * use galaxy versions and add note for release * update reqs * add workflow for requirements verification * updated azure reqs and docs fix * update workflows
- Loading branch information
Showing
15 changed files
with
198 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ on: | |
branches: | ||
- main | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
analyze-code: | ||
runs-on: ubuntu-latest | ||
|
@@ -19,22 +21,22 @@ jobs: | |
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | ||
with: | ||
python-version: '3.10' | ||
|
||
- uses: isort/isort-action@master | ||
- uses: isort/isort-action@f14e57e1d457956c45a19c05a89cccdf087846e5 # v1.1.0 | ||
with: | ||
requirementsFiles: "requirements.txt" | ||
|
||
- name: Run check-yaml, end-of-file-fixer, trailing-whitespace | ||
uses: pre-commit/[email protected].0 | ||
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | ||
|
||
- name: Run ansible-lint | ||
uses: ansible/ansible-lint@main | ||
uses: ansible/ansible-lint@95382d398ea1744bf6bfa47b030f14c38b3f6957 # v24.7.0 | ||
|
||
- name: Install detect-secrets | ||
run: pip install detect-secrets==1.4.0 | ||
|
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,33 @@ | ||
# .github/workflows/requirements.yml | ||
name: requirements.txt combatibility | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: | ||
- main | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
install-requirements: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt --no-deps |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace: cisco | ||
name: sdwan | ||
version: 0.1.0 | ||
version: 0.2.0 | ||
readme: README.md | ||
authors: | ||
- Arkadiusz Cichon <[email protected]> | ||
|
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,22 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
# NOTE: This is example playbook that requires following variables: | ||
# manager_authentication: url, username, password | ||
# backup_dir_path | ||
|
||
- name: Example playbook with task to backup Device Templates with Policies and Feature Templates | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
manager_authentication: &manager_authentication | ||
url: # your manager url | ||
username: # your manager username | ||
password: # your manager password | ||
tasks: | ||
- name: Perform backup of all non factory default Device Templates (no filters == backup non factory default) | ||
cisco.catalystwan.device_templates_recovery: | ||
mode: backup | ||
# backup_dir_path: # path to create backup directory that will store exported configuration | ||
manager_credentials: | ||
<<: *manager_authentication |
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,23 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
--- | ||
|
||
- name: Example playbook for backup of running config | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
manager_authentication: &manager_authentication | ||
url: # your manager url | ||
username: # your manager username | ||
password: # your manager password | ||
tasks: | ||
- name: Backup running-config for all c8000V devices with default backup dir (in CWD) | ||
cisco.catalystwan.devices_info: | ||
backup: true | ||
backup_dir_path: # your backup bath | ||
filters: | ||
personality: "vedge" | ||
manager_credentials: | ||
<<: *manager_authentication | ||
register: backup_info |
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,22 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
# NOTE: This is example playbook that requires following variables: | ||
# manager_authentication: url, username, password | ||
# backup_dir_path | ||
|
||
- name: Example playbook with task to restore Device Templates with Policies and Feature Templates | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
manager_authentication: &manager_authentication | ||
url: # your manager url | ||
username: # your manager username | ||
password: # your manager password | ||
tasks: | ||
- name: Restore configuration from provided backup directory | ||
cisco.catalystwan.device_templates_recovery: | ||
mode: restore | ||
# backup_dir_path: # path to backup directory from which templates will be imported | ||
manager_credentials: | ||
<<: *manager_authentication |
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,41 @@ | ||
# Copyright 2024 Cisco Systems, Inc. and its affiliates | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
--- | ||
|
||
- name: Testing playbook to verify backup & restore operations | ||
hosts: localhost | ||
gather_facts: false | ||
vars_files: | ||
- configuration_file_dev_vars.yml | ||
vars: | ||
manager_authentication: &manager_authentication | ||
url: # your manager url | ||
username: # your manager username | ||
password: # your manager password | ||
tasks: | ||
- name: Using backup files, create CLI templates for each Edge device | ||
cisco.catalystwan.cli_templates: | ||
state: present | ||
template_name: "backup-template-{{ device_item.filename }}" | ||
template_description: "Template for {{ device_item.hostname }} created from backup file." | ||
config_file: "{{ device_item.backup_path }}" | ||
device_model: vedge-C8000V | ||
manager_credentials: | ||
<<: *manager_authentication | ||
loop: "{{ backup_info.backup_paths }}" | ||
loop_control: | ||
loop_var: device_item | ||
when: backup_info.backup_paths | length > 0 | ||
|
||
- name: Attach backup templates to the Edge devices | ||
cisco.catalystwan.device_templates: | ||
state: attached | ||
template_name: "backup-template-{{ device_item.filename }}" | ||
hostname: "{{ device_item.hostname }}" | ||
manager_credentials: | ||
<<: *manager_authentication | ||
loop: "{{ backup_info.backup_paths }}" | ||
loop_control: | ||
loop_var: device_item | ||
when: backup_info.backup_paths | length > 0 |
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
Oops, something went wrong.