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.

Backup Dell EMC DNOS 6 Configs with Ansible Playbook

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

Discover how to automate Dell EMC DNOS 6 configuration backups with Ansible. This guide includes a Playbook example and setup instructions for efficient.

Backup Dell EMC DNOS 6 Configs with Ansible Playbook

How to Backup Config on Dell EMC Networking Operating System DNOS 6 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: Automate Dell EMC DNOS 10 Backups with Ansible Playbook

Ansible Backup Config on DNOS 6

• dellemc.os6.os6_config • Manage Dell EMC OS6 configuration sections

Let's talk about the Ansible module os6_config. The full name is dellemc.os6.os6_config, which means that is part of the collection dellemc.os6 specialized in the module to interact with Ansible Network Collection for Dell EMC OS6. This collection requires ansible-core version 2.10+. It manages Dell EMC OS6 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 os6_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 OS6 Platform Optionsdellemc.os6.os6_config module

Demo

How to Backup Config on Dell Networking Operating System 6 with Ansible Playbook. I'm going to show how to back up the current configuration of a Dell Networking Operating System 6 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
[dellos6]
192.168.88.3
[dellos6:vars]
ansible_user=luca
ansible_password=mysecretpassword123
ansible_become=yes
ansible_become_method=enable
ansible_connection=ansible.netcommon.network_cli
ansible_network_os=dellemc.os6.os6
ansible_command_timeout=120
• backup_dellos6.yml
---
- name: Backup DNOS6
  hosts: dellos6
  gather_facts: false
  vars:
    backup_dir: "/home/luca/network/backup"
  tasks:
    - name: Backup
      dellemc.os6.os6_config:
        backup: true
        backup_options:
          dir_path: "{{ backup_dir }}"
• requirements.yml
---
collections:
  - name: dellemc.os6

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-os6-1.0.7.tar.gz to /home/luca/.ansible/tmp/ansible-local-46189694_j598/tmp2rjavc0i/dellemc-os6-1.0.7-1grhtwx1
Installing 'dellemc.os6:1.0.7' to '/home/luca/.ansible/collections/ansible_collections/dellemc/os6'
Downloading https://galaxy.ansible.com/download/ansible-netcommon-3.0.0.tar.gz to /home/luca/.ansible/tmp/ansible-local-46189694_j598/tmp2rjavc0i/ansible-netcommon-3.0.0-ctz29dou
dellemc.os6:1.0.7 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-46189694_j598/tmp2rjavc0i/ansible-utils-2.6.1-ytnvukj8
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
$ ansible-galaxy collection list
# /home/luca/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 3.0.0  
ansible.utils     2.6.1  
dellemc.os6       1.0.7  

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.3
The authenticity of host '192.168.88.3 (192.168.88.3)' can't be established.
RSA key fingerprint is SHA256:*********************************************.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.88.3' (RSA) to the list of known hosts.
luca@192.168.88.3's password:

execution

$ ansible-playbook -i inventory backup_dellos6.yml
PLAY [Backup DNOS6] *******************************************************************************
TASK [Backup] *************************************************************************************
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
changed: [192.168.88.3]
PLAY RECAP ****************************************************************************************
192.168.88.3               : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

before execution

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

after execution

$ ls -al backup
total 16
drwxrwxr-x 2 luca luca 4096 May  5 09:46 .
drwxr-xr-x 3 luca luca 4096 May  5 09:45 ..
-rw-rw-r-- 1 luca luca  610 May  5 09:45 192.168.88.3_config.2022-05-05@09:45:54
-rw-rw-r-- 1 luca luca  610 May  5 09:46 192.168.88.3_config.2022-05-05@09:46:27
luca@luca01:~/network$ file backup/*
backup/192.168.88.3_config.2022-05-05@09:45:54: ASCII text
backup/192.168.88.3_config.2022-05-05@09:46:27: 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 6 with Ansible.

Related Articles

private Galaxy servers and Ansibleprivilege escalation with Ansible becomehow Ansible inventory works

Category: installation

Watch the video: Backup Dell EMC DNOS 6 Configs with Ansible Playbook — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home