---
- name: Ensure ansible_facts used by role
  setup:
    gather_subset: min
  when: not ansible_facts.keys() | list | intersect(__ssh_required_facts) == __ssh_required_facts

- name: Set platform/version specific variables
  include_vars: "{{ __vars_file }}"
  loop:
    - "{{ ansible_facts['os_family'] }}.yml"
    - "{{ ansible_facts['distribution'] }}.yml"
    - >-
      {{ ansible_facts['distribution'] ~ '_' ~
      ansible_facts['distribution_major_version'] }}.yml
    - >-
      {{ ansible_facts['distribution'] ~ '_' ~
      ansible_facts['distribution_version'] }}.yml
  vars:
    __vars_file: "{{ role_path }}/vars/{{ item }}"
  when: __vars_file is file
