Ansible Pilot

Backup Config on Dell EMC Networking Operating System DNOS 10 - Ansible Network dellemc.os10

How to automate network device configuration backup for Dell EMC OS10 network appliances connecting via SSH protocol using the username and password credentials with Enable Mode (Privilege Escalation) and save it to a file using Ansible Network dellemc.os10.

May 5, 2022
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

How to Backup Config on Dell EMC Networking Operating System DNOS 10 with Ansible?

Maintaining a backup copy of your network appliance configuration is a good practice for all IT professionals. You could automate this process for Dell EMC network appliances using Ansible. I’m going to show you a live demo with some simple Ansible code. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible Backup Config on DNOS 10

Let’s talk about the Ansible module os10_config. The full name is dellemc.os10.os10_config, which means that is part of the collection dellemc.os10 specialized in the module to interact with Ansible Network Collection for Dell EMC OS10. This collection requires ansible-core version 2.10+. It manages Dell EMC OS10 configuration sections.

Parameters

Let me summarize the parameter of os10_config module for the backup use-case. The backup boolean enables the backup mode of the configuration. Once enabled you could specify some backup_options. I suggest you specify the dir_path, the directory where to save backups, and the filename if you have a specific one. Otherwise, Ansible is going to create a file with the current timestamp.

Demo

How to Backup Config on Dell Networking Operating System 10 with Ansible Playbook. I’m going to show how to back up the current configuration of a Dell Networking Operating System 10 connecting via SSH protocol using username and password credentials with Enable Mode (Privilege Escalation) and save it to a file with the device name and timestamp.

code

[dellos10]
192.168.88.4
[dellos10:vars]
ansible_user=luca
ansible_password=mysecretpassword123
ansible_become=yes
ansible_become_method=enable
ansible_connection=ansible.netcommon.network_cli
ansible_network_os=dellemc.os10.os10
ansible_command_timeout=120
---
- name: Backup DNOS10
  hosts: dellos10
  gather_facts: false
  vars:
    backup_dir: "/home/luca/network/backup"
  collections:
    - dellemc.os10
  tasks:
    - name: Backup
      os10_config:
        backup: true
        backup_options:
          dir_path: "{{ backup_dir }}"
---
collections:
  - name: dellemc.os10

requirements setup

$ ansible-galaxy install -r requirements.yml 
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/dellemc-os10-1.1.1.tar.gz to /home/luca/.ansible/tmp/ansible-local-46508ny86lv8w/tmpadif077y/dellemc-os10-1.1.1-8u8own42
Installing 'dellemc.os10:1.1.1' to '/home/luca/.ansible/collections/ansible_collections/dellemc/os10'
Downloading https://galaxy.ansible.com/download/ansible-netcommon-3.0.0.tar.gz to /home/luca/.ansible/tmp/ansible-local-46508ny86lv8w/tmpadif077y/ansible-netcommon-3.0.0-lhqgi1da
dellemc.os10:1.1.1 was installed successfully
Installing 'ansible.netcommon:3.0.0' to '/home/luca/.ansible/collections/ansible_collections/ansible/netcommon'
Downloading https://galaxy.ansible.com/download/ansible-utils-2.6.1.tar.gz to /home/luca/.ansible/tmp/ansible-local-46508ny86lv8w/tmpadif077y/ansible-utils-2.6.1-s3xonkdx
ansible.netcommon:3.0.0 was installed successfully
Installing 'ansible.utils:2.6.1' to '/home/luca/.ansible/collections/ansible_collections/ansible/utils'
ansible.utils:2.6.1 was installed successfully
[email protected]:~/network$ ansible-galaxy collection list
# /home/luca/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 3.0.0  
ansible.utils     2.6.1  
dellemc.os10      1.1.1  

first run

Firstly you need to save the SSH fingerprint of the network device on your system. You could execute an SSH connection, reply yes when asked to save the fingerprint, and terminate (CTRL+C).

$ ssh [email protected]
The authenticity of host '192.168.88.4 (192.168.88.4)' can't be established.
ECDSA key fingerprint is SHA256:********************************************.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.88.4' (ECDSA) to the list of known hosts.
Debian GNU/Linux 9
Dell EMC Networking Operating System (OS10)
[email protected]'s password:

execution

[email protected]:~/network$ ansible-playbook -i inventory backup_dellos10.yml
PLAY [Backup DNOS10] ******************************************************************************
TASK [Backup] *************************************************************************************
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
changed: [192.168.88.4]
PLAY RECAP ****************************************************************************************
192.168.88.4               : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
[email protected]:~/network$

before execution

[email protected]:~/network$ pwd
/home/luca/network
[email protected]:~/network$ ls
backup_dellos10.yml  inventory requirements.yml
[email protected]:~/network$ ansible --version
ansible [core 2.12.4]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/luca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/luca/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True
[email protected]:~/network$

after execution

[email protected]:~/network$ ls -al backup
total 16
drwxrwxr-x 2 luca luca 4096 May  5 11:13 .
drwxr-xr-x 3 luca luca 4096 May  5 11:12 ..
-rw-rw-r-- 1 luca luca 3751 May  5 11:12 [email protected]:12:26
-rw-rw-r-- 1 luca luca 3751 May  5 11:13 [email protected]:13:06
[email protected]:~/network$ file backup/*
backup/[email protected]:12:26: ASCII text
backup/[email protected]:13:06: ASCII text
[email protected]:~/network$

code with ❤️ in GitHub

Recap

Now you know how to Backup Config on Dell EMC Networking Operating System DNOS 10 with Ansible. Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 200+ Ansible code

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Trustpilot
Follow me

Subscribe not to miss any new releases

FREE Top 10 Best Practices

Top 10 Best Practices of Ansible Automation: save time, reduce errors and stress