Created
June 16, 2023 17:47
-
-
Save nleiva/c124ce2e5ab0182d4780451771557ffb to your computer and use it in GitHub Desktop.
Parsing Cisco ASA with a NTC template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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