---
- name: Gather facts for non-network to get ansible_distribution
  gather_facts:
  when: ansible_network_os is not defined

- name: Set a short name
  set_fact:
    os: "{{ ansible_distribution|d or (ansible_network_os|d('')).split('.')[-1] }}"

- include_tasks: argspec.yaml
  when: inventory_hostname == 'localhost'
  vars:
    parser: "({{ inventory_hostname }}/argspec)"

- include_tasks: "{{ os|lower }}_native.yaml"
  vars:
    parser: "({{ os }}/native)"
  tags:
    - native

- include_tasks: "{{ os|lower }}_json.yaml"
  vars:
    parser: "({{ os }}/json)"
  when: "os in ['nxos']"
  tags:
    - json

- include_tasks: "{{ os|lower }}_ntc_templates.yaml"
  vars:
    parser: "({{ os }}/ntc_templates)"
  when: "os in ['nxos']"
  tags:
    - ntc_templates

- include_tasks: "{{ os|lower }}_pyats.yaml"
  vars:
    parser: "({{ os }}/pyats)"
  when: "os in ['nxos']"
  tags:
    - pyats

- include_tasks: "{{ os|lower }}_textfsm.yaml"
  vars:
    parser: "({{ os }}/textfsm)"
  when: "os in ['nxos']"
  tags:
    - textfsm

- include_tasks: "{{ os|lower }}_ttp.yaml"
  vars:
    parser: "({{ os }}/ttp)"
  when: "os in ['nxos']"
  tags:
    - ttp


- include_tasks: "{{ os|lower }}_xml.yaml"
  vars:
    parser: "({{ os }}/textfsm)"
  when: "os in ['nxos']"
  tags:
    - xml
