--- - name: Include distribution specific variables include_vars: file: "{{ item }}" name: _os_specific with_first_found: - "{{ ansible_distribution_release }}.yml" - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" - "default.yml" - name: Set OS specific vars if undefined set_fact: { "{{ item.key }}": "{{ hostvars[inventory_hostname][item.key] | default(item.value) }}" } with_dict: "{{ _os_specific }}" # vim: set ts=2 sw=2: