Skip to content

Instantly share code, notes, and snippets.

@nleiva
Created June 16, 2023 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nleiva/c124ce2e5ab0182d4780451771557ffb to your computer and use it in GitHub Desktop.
Save nleiva/c124ce2e5ab0182d4780451771557ffb to your computer and use it in GitHub Desktop.
Parsing Cisco ASA with a NTC template
- name: Parse config with ntc_templates
ansible.utils.cli_parse:
text: "{{ lookup('file', config) }}"
parser:
name: ansible.netcommon.ntc_templates
os: cisco_asa
command: "show running-config {{ ( item ) | replace('_',' ') }}"
set_fact: "{{ item | replace('-','_') }}"
loop:
- ipsec
- crypto_ikev1
- tunnel-group
- name: Save config parsed with ntc_templates
ansible.builtin.copy:
content: "{{ item.content | ansible.builtin.to_nice_yaml }}"
dest: "/output/asa_{{ item.name }}.cfg"
loop:
- name: ipsec
content: "{{ ipsec }}"
- name: crypto_ikev1
content: "{{ crypto_ikev1 }}"
- name: tunnel_group
content: "{{ tunnel_group }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment