Have you ever faced a situation where you had to perform a disaster recovery or a configuration change rollback? That’s when the – hopefully recent – backups come to play. Ansible has the beauty of network automation and can perform these tasks for you with zero effort.
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.
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.