-
Ansible Network Backup Collection contains the role which provides a platform-agnostic way of managing network backup on supported network platforms. This collection provides the user the capabilities to create, compare and tag backups supporting local and remote data stores.
-
Network Backup collection can be used by anyone who are looking to manage and maintain network infrastructure, automate the backup process, and ensure data is regularly and securely backed up. This includes system administrators and IT professionals.
- Requires Ansible
- Requires Content Collections
- Testing Requirements
- Users also need to include platform collections as per their requirements. The supported platform collections are:
To consume this Validated Content from Automation Hub, the following needs to be added to ansible.cfg:
[galaxy]
server_list = automation_hub
[galaxy_server.automation_hub]
url=https://console.redhat.com/api/automation-hub/content/validated/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=<SuperSecretToken>
Utilize the current Token, and if the token has expired, obtain the necessary token from the Automation Hub Web UI.
With this configured, simply run the following commands:
ansible-galaxy collection install network.base
ansible-galaxy collection install network.backup
Full Backup
:
- This enables the user to fetch running network configuration from the device and save the backup to a local or remote data store
- Users can also push backup files onto GitHub with tags.
Differential backup
:
- This enables users to backup network configuration only when there has been some change since the last time we did a backup.
- Users can use this operation to get differential backup and save the backed-up files to either the local data store or to the GitHub repository
- Users can also push backup files onto GitHub with tags.
run.yml
---
- hosts: rtr1
gather_facts: true
tasks:
- name: Network Backup and Resource Manager
ansible.builtin.include_role:
name: network.backup.run
vars:
operation: backup
type: full
data_store:
local: "./network_local_backup/network"
run.yml
---
- hosts: rtr1
gather_facts: true
tasks:
- name: Network Backup and Resource Manager
ansible.builtin.include_role:
name: network.backup.run
vars:
operation: backup
type: full
data_store:
scm:
origin:
url: "{{ GIT_REPO }}"
token: "{{ GH_ACCESS_TOKEN }}"
user:
name: "{{ username }}"
email: "{{ email }}"
run.yml
---
- hosts: rtr1
gather_facts: true
tasks:
- name: Network Backup and Resource Manager
ansible.builtin.include_role:
name: network.backup.run
vars:
operation: backup
type: diff
data_store:
local: "./network_local_backup/network"
run.yml
---
- hosts: rtr1
gather_facts: true
tasks:
- name: Network Backup and Resource Manager
ansible.builtin.include_role:
name: network.backup.run
vars:
operation: backup
type: diff
data_store:
scm:
origin:
url: "{{ GIT_REPO }}"
token: "{{ GH_ACCESS_TOKEN }}"
tag: default
user:
name: "{{ username }}"
email: "{{ email }}"
The project uses tox to run ansible-lint
and ansible-test sanity
.
Assuming this repository is checked out in the proper structure,
e.g. collections_root/ansible_collections/network/backup
, run:
tox -e ansible-lint
tox -e py39-sanity
To run integration tests, ensure that your inventory has a network_base
group.
Depending on what test target you are running, comment out the host(s).
[network_hosts]
ios
junos
[ios:vars]
< enter inventory details for this group >
[junos:vars]
< enter inventory details for this group >
ansible-test network-integration -i /path/to/inventory --python 3.9 [target]
We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against this repository.
Don't know how to start? Refer to the Ansible community guide!
Want to submit code changes? Take a look at the Quick-start development guide.
We also use the following guidelines:
This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.
Release notes are available here.
- Developing network resource modules
- Ansible Networking docs
- Ansible Collection Overview
- Ansible Roles overview
- Ansible User guide
- Ansible Developer guide
- Ansible Community Code of Conduct
GNU General Public License v3.0 or later.
See LICENSE to see the full text.