Skip to content

Instantly share code, notes, and snippets.

@NilashishC
Last active September 13, 2022 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NilashishC/a777029f0927c0ada682e26465c47054 to your computer and use it in GitHub Desktop.
Save NilashishC/a777029f0927c0ada682e26465c47054 to your computer and use it in GitHub Desktop.
---
- name: Gather route-maps configuration as structured data
hosts: nxos
gather_facts: no
vars:
destination: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}"
tasks:
- name: Use Route Maps resource module to gather existing configuration
cisco.nxos.nxos_route_maps:
state: gathered
register: route_maps
- name: Create inventory directory
ansible.builtin.file:
path: "{{ destination }}"
state: directory
- name: Write the Route Maps configuration to a file
ansible.builtin.copy:
content: "{{ {'route_maps': route_maps['gathered']} | to_nice_yaml }}"
dest: "{{ destination }}/route_maps.yaml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment