Backup Netscaler using ansible

To backup the configuration of any device is a best practice in any technology field. Also backing up not only the configuration file but other relevant files of a device is also a good practice.
Netscalers backup by default every day eveything that is in ” /nsconfig” folder. It creates an archive with all the contents of the folder , like : ssl certificates, license, ZebOS file (routing part).
Using this backup archive a restore of the whole appliance can be done very easy. But you first need to have the backups in another location , not on the device. If the device fails, you lost your backups . So having a central point (server) where you keep all your backup’s would be desired.

To tackle this scenario i’ve have created a script/playbook in ansible that creates and downloads the backup using nitro API calls. It also does some cleanup by erasing the backup from the Netscaler. It saves the backup by default in the folder ” /home/ansible/ns_sys_backup “. But you can change it to whatever folder you want.
As the downloaded file is encoded in base64 , there is a part that decodes the file and the output is the tar archive. It is using the base64 command under linux.

Here you can find the files for this project:

About the author

Mihai is a Network Aficionado with more than 10 years experience