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

19 lines
696 B
YAML

---
- ansible.builtin.set_fact:
nxos_json_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_json_text.txt') }}"
- name: "{{ parser }} Run command and parse with json"
ansible.utils.cli_parse:
text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_json_text.txt') }}"
parser:
name: ansible.utils.json
register: nxos_json_text
- name: "{{ parser }} Confirm response"
assert:
that: "{{ item }}"
with_items:
- "{{ nxos_json_text['parsed'] is defined }}"
- "{{ nxos_json_text['parsed'][0][0][0]['admin_state'] is defined }}"
- "{{ nxos_json_text['parsed'] == nxos_json_text_parsed }}"