eos_snapshot¶
Overview¶
eos_snapshot is a role leveraged to collect commands on Arista EOS devices and generate a report. It supports reports with the following format: text, markdown, JSON, and YAML.
Role Inputs and Outputs¶
Figure 1 below visualizes the role’s inputs, outputs, and tasks.
Inputs:
Ansible inventory to connect to EOS devices. The default variables can be changed to select a report format and include others commands.
Outputs:
- Text files: one file per device and show command
- Markdown file: one report per device
- JSON file: one report per fabric
- YAML file: one report per fabric
Tasks:
- Create output structure
- Collect show commands on device
- Save the collected commands
- Generate a JSON report
- Generate a YAML report
- Generate a markdown report
Default Variables¶
The following default variables are defined, and can be modified as desired:
---
root_dir: '{{ inventory_dir }}'
snapshots_backup_dir_name: 'commands'
snapshots_backup_dir: '{{ root_dir }}/{{ commands_backup_dir_name }}'
# list of desired formats. Supported values are markdown, json and text.
# text: one file per device and show command
# markdown: one report per device
# json: one report per fabric
# yaml: one report per fabric
output_format:
- text
- markdown
# - json
# - yaml
commands_list:
- show lldp neighbors
- show ip interface brief
- show interfaces description
- show version
- show running-config
Requirements¶
Requirements are located here: avd-requirements
Example Playbook¶
---
- name: Collect commands
hosts: DC1_FABRIC
connection: local
gather_facts: false
collections:
- arista.avd
tasks:
- name: Collect commands
ansible.builtin.import_role:
name: eos_snapshot
Input example¶
inventory/inventory.ini¶
---
all:
children:
DC1:
children:
DC1_FABRIC:
children:
DC1_SPINES:
hosts:
switch2:
ansible_host: 10.83.28.190
DC1_L3LEAFS:
children:
DC1_LEAF1:
hosts:
switch1:
ansible_host: 10.83.28.216
DC1_LEAF2:
hosts:
switch3:
ansible_host: 10.83.28.191
inventory/group_vars/DC1.yml¶
ansible_user: 'arista'
ansible_password: 'arista'
ansible_network_os: eos
ansible_become: yes
ansible_become_method: enable
output_format:
- text
- markdown
# - json
# - yaml
commands_list:
- show lldp neighbors
- show ip interface brief
- show interfaces description
- show version
- show running-config
Usage example¶
License¶
Project is published under Apache 2.0 License
Last update:
February 10, 2023