---
- name: Ensure ansible_facts used by role
  setup:
    gather_subset: "{{ __nbde_client_required_facts_subsets }}"
  when: __nbde_client_required_facts |
    difference(ansible_facts.keys() | list) | length > 0

- name: Set platform/version specific variables
  include_vars: "{{ lookup('first_found', ffparams) }}"
  vars:
    ffparams:
      files:
        - "{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_version'] }}.yml"  # yamllint disable-line rule:line-length
        - "{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"  # yamllint disable-line rule:line-length
        - "{{ ansible_facts['distribution'] }}.yml"
        - "{{ ansible_facts['os_family'] }}.yml"
        - "default.yml"
      paths:
        - "{{ role_path }}/vars"
