AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Automate Dell EMC DNOS 10 Backups with Ansible Playbook

By Luca Berton · Published 2024-01-01 · Category: installation

Learn to automate the backup of Dell EMC DNOS 10 configurations with Ansible. This guide includes a practical Playbook example and setup instructions.

Automate Dell EMC DNOS 10 Backups with Ansible Playbook

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 Playbook with some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot.

See also: Backup Dell EMC DNOS 6 Configs with Ansible Playbook

Ansible Backup Config on DNOS 10

> dellemc.os10.os10_config: Manage Dell EMC OS10 configuration sections

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

• backup boolean - no/yes • backup_options dictionary - configurable options related to a backup file path • dir_path path - If the directory does not exist it will be first created • filename string - \\_config.\@\

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.

See also: Automate Mikrotik RouterOS Config Backups with Ansible

Links

Dell OS10 Platform Optionsdellemc.os10.os10_configos10_config backup option not working #113

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

• inventory
[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
• backup_dellos10.yml
---
- 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 }}"
• requirements.yml
---
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
luca@luca01:~/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 luca@192.168.88.4
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)
luca@192.168.88.4's password:

execution

luca@luca01:~/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
luca@luca01:~/network$

before execution

luca@luca01:~/network$ pwd
/home/luca/network
luca@luca01:~/network$ ls
backup_dellos10.yml  inventory requirements.yml
luca@luca01:~/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
luca@luca01:~/network$

after execution

luca@luca01:~/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 192.168.88.4_config.2022-05-05@11:12:26
-rw-rw-r-- 1 luca luca 3751 May  5 11:13 192.168.88.4_config.2022-05-05@11:13:06
luca@luca01:~/network$ file backup/*
backup/192.168.88.4_config.2022-05-05@11:12:26: ASCII text
backup/192.168.88.4_config.2022-05-05@11:13:06: ASCII text
luca@luca01:~/network$

code with ❤️ in GitHub

See also: Retrieve ASM Policy Facts from the F5 BIG-IP Platform Network Infrastructure

Conclusion

Now you know how to Backup Config on Dell EMC Networking Operating System DNOS 10 with Ansible.

Related Articles

Ansible Galaxy guideusing become for sudo in Ansibleorganizing hosts with Ansible inventory

Category: installation

Watch the video: Automate Dell EMC DNOS 10 Backups with Ansible Playbook — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home