08-11-2020 11:39 AM - edited 08-11-2020 01:54 PM
I need to backup the CSR's config such that it can be used to configure a new instance of CSR in case of disaster recovery. I'm trying to backup the config on CSR 1000v EC2 instance to an AWS S3 bucket. So far, I have written a Python script which uses Paramiko to SSH into CSR and get its config. The next step intended is to store the config to an S3 bucket. I'm yet to figure out how that can be done but wanted your advice if this approach is correct or if you can advise a better one.
Thanks
08-13-2020 02:28 AM
Hi,
I would suggest looking into doing this with Ansible rather than native Python, it would make it easier to transfer knowledge, maintain the system and also from a scripting point of view abstracts all the authentication and error management.
It also makes evolutions easier to manage, if for instance AWS changes API endpoints or the like.
Take a look at this module for the storage of the config part :
And this on with the backup option to grab the configuration :
Taking it further you could then write the reverse playbook that would create a new CSR instance and load the config into it.
Hope this helps, that how i'd do it anyway
08-13-2020 07:18 AM - edited 08-13-2020 07:33 AM
Thank you for your reply, @craig.armstrong and for the useful links you shared. I am new to Ansible but will try to implement it, the way you mentioned. The reason I chose Python was that I need this service to even listen to syslogs streamed over a TCP port from the CSR. The same service would be used to trigger periodic backups (fetch running config and store in S3 bucket).
08-13-2020 08:39 AM
That sounds complex, but you could always have you Python Syslog listener trigger the Ansible Play, or even use tools like Splunk to centralize the syslog messages and create the trigger from there.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide