---
- name: "Run command and parse with {{ parser }}"
  ansible.utils.cli_parse:
    command: "show interface"
    parser:
      name: ansible.netcommon.ntc_templates
  register: nxos_ntc_templates_command

- name: "Pass text and command to {{ parser }}"
  ansible.utils.cli_parse:
    text: "{{ nxos_ntc_templates_command['stdout'] }}"
    parser:
      name: ansible.netcommon.ntc_templates
      command: show interface
  register: nxos_ntc_templates_text

- name: "Check output"
  ansible.builtin.assert:
    that: "{{ item }}"
  with_items:
    - "{{ nxos_ntc_templates_command['stdout'] is defined }}"
    - "{{ nxos_ntc_templates_command['stdout_lines'] is defined }}"
    - "{{ nxos_ntc_templates_command['parsed'] == nxos_ntc_templates_text['parsed'] }}"
    - "{{ (nxos_ntc_templates_command['parsed'] | selectattr('interface', 'search', 'mgmt0') | list | length) > 0 }}"
