Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
---
- 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