ansible.utils/tests/integration/targets/utils_cli_parse/tasks/nxos_textfsm.yaml

21 lines
834 B
YAML

---
- name: Set fact
ansible.builtin.set_fact:
nxos_textfsm_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_version_textfsm_parsed.json') | from_json }}"
- name: "Pass text and command {{ parser }}"
ansible.utils.cli_parse:
text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_version.txt') }}"
parser:
name: ansible.utils.textfsm
template_path: "{{ role_path }}/templates/nxos_show_version.textfsm"
register: nxos_textfsm_text
- name: "Confirm response {{ parser }}"
ansible.builtin.assert:
that: "{{ item }}"
with_items:
- "{{ nxos_textfsm_text['parsed'] == nxos_textfsm_text['parsed'] }}"
- "{{ nxos_textfsm_text['parsed'][0]['BOOT_IMAGE'] is defined }}"
- "{{ nxos_textfsm_text['parsed'][0] == nxos_textfsm_text_parsed }}"