https://github.com/nomaster/backup-ubnt-ansible
Backup Ubiquiti routers and switches with Ansible
https://github.com/nomaster/backup-ubnt-ansible
Last synced: about 1 month ago
JSON representation
Backup Ubiquiti routers and switches with Ansible
- Host: GitHub
- URL: https://github.com/nomaster/backup-ubnt-ansible
- Owner: nomaster
- Created: 2020-01-08T12:23:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-08T21:49:20.000Z (almost 3 years ago)
- Last Synced: 2025-02-16T04:23:29.080Z (3 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Backup Ubiquiti Networks devices
## Description
This repository shows how to backup configration of Ubiquiti Networks devices with Ansible. The list of devices, as well as the passwords to access them, are pulled from NetBox.
We use native Ansible modules to fetch configuration for each device and store them in `backup/[hostname].cfg`.
The examples here apply to Freifunk Düsseldorf. Please adjust the variables to your installation.
## Requirements
Install Python 3.6 or higher and then the requirements with the following command:
```
pip install --user -r requirements.txt
```Set an environment variable with the path of our NetBox installation:
```
export NETBOX_API=https://netbox.freifunk-duesseldorf.de
```Create a [NetBox token](https://netbox.freifunk-duesseldorf.de/user/api-tokens/) and set a environment variable in your shell:
```
export NETBOX_TOKEN=[your token]
```Finally, create a [NetBox secret key](https://netbox.freifunk-duesseldorf.de/user/user-key/) and put it in a file:
```
export NETBOX_KEY_PATH=[path to your key file]
```Then you're all set!
## Usage
After changing configuration on a device, run the following command to fetch its configuration:
```
ansible-playbook fetch.yml
```Then commit the changes in the backup folder to git