Developer

last person joined: 3 days ago 

Demoing Ansible and AOS-CX: Config backups to AWS S3

  • 1.  Demoing Ansible and AOS-CX: Config backups to AWS S3

    Posted Nov 08, 2020 10:11 PM

    Hello Airheads community

    I want to share an automation demo applied to AOS-CX switches: take network backups and save these backups in a reliable and secure place. With this demo, you can show to customers and prospects automation capabilities of AOS-CX and how much time can be saved by automating repetitive tasks. 

    Proposed automation workflow is as follows (Figure 1):

    workflow

    Figure 1


    Workflow steps:

    1. Host Inventory file with management IP addresses of AOS-CX switches.


    2. Playbook file with two tasks:
      2A. Take config backup of AOS-CX switch.
      2B. Synch the backup folder with a bucket in AWS S3.

    3. Run the playbook.

    4. Ansible communicates with the AOS-CX switches that are part of the Host Inventory file, saves the configurations in a local folder and finally synchronizes the folder with a bucket in S3.

     

    Video of the demo:



    How to setup the demo:

    1. Create a Bucket:

     

    2. Create an AMI User, Access type set to "programmatic access":

    3. Attach a policy to the AMI User in order to allow access to the S3 bucket:


    4. "aoscx_backup_config" en arubanetworks.aoscx ansible collection:

    https://galaxy.ansible.com/arubanetworks/aoscx


    5. "s3_sync" en community.aws ansible collection:

    https://docs.ansible.com/ansible/latest/collections/community/aws/s3_sync_module.html


    6. Set the ansible_python_interpreter value; Ansible tries to use Python 2 (/usr/bin/python) by default. Details: https://blog.networktocode.com/post/Ansible-Required-Library/


    Code attached.


    Regards,

    Adolfo



    ------------------------------
    Adolfo Bolivar
    ------------------------------

    Attachment(s)

    txt
    cx_hosts.txt   591 B 1 version
    txt
    AOS-CX-Backup.txt   680 B 1 version