This article shows how you can easily backup your entire Alcatel-Lucent Enterprise Omniswitch environment by using Ansible. For AOS6 devices we use Gilbert Moisio’s Ansible collection to scrape the CLI through the popular Netmiko Python library. AOS8 devices have the advantage of a REST API, so we can authenticate with the return cockie and request the running configuration in a JSON structured format through a https REST call.
You can store the backup files locally or even better, push them to a remote GIT repository. The result is a CMDB (configuration management database) in which the different backup versions are stored and where you can easily compare them to track changes.
![AOS6 AOS8](https://spacewalkers.s3.eu-west-3.amazonaws.com/git_compare_1024x273_2113481079.png)
Initial setup and installation
Want to get a head start? All demo files are available through following GitHub remote repository, ready to be cloned locally.
Before we get started, create a virtual Python environment, install the required Python packages as found in requirements.txt and install the Ansible modules found in requirements.yml. These modules extend the Ansible functionality and can be called in the Ansible Playbooks, the files where the job logic gets described in sequential tasks.
Inventory host and variable configuration
Run Ansible playbook backup-all.yml
Note for production: Variables are stored in plain text, which is definitly not best practice. Ansible provides the Vault functionality that encrypts variables and files to secure sensitive information.