Ansible can be used to save current configuration of Nodegrid device and saved as a backup file.
In local backup, the saved configuration will be saved locally in the Nodegrid.
This is the template file one needs for this task: localbackup.j2
Here template file is in templates folder. So, the path is /etc/ansible/templates/localbackup.j2
- cd /system/toolkit
- save_settings
- set destination=local_system
- set filename={{ ng_backup }}
- save
- finish
- commit
Next task is to create a playbook to run this task: localbackup.yml
This yml file is at /etc/ansible/localbackup.yml
- ---
- - name: Take a backup of remote nodegrid
- hosts: Nodegrid
- become: true
- gather_facts: yes
- vars:
- ng_backup: newbackup
- tasks:
- - name: Copy template to remote nodegrid
- template:
- src: templates/localbackup.j2
- dest: /tmp/localbackup.cli
- - name: Apply the backup
- command: cli -f /tmp/localbackup.cli
- - name: ACK
- debug:
- msg: " Backup is created "
Now, run the playbook with command: ansible-playbook localbackup.yml
One will see that backup will be saved in /backup folder with filename given in the playbook.