--- - name: lookup bootstrap facts become: no raw: "cat /etc/os-release" check_mode: no register: bootstrap_facts changed_when: no vars: ansible_user: "{{ bootstrap_user }}" - name: set bootstrap facts (I) set_fact: bootstrap_distribution: "{{ item }}" bootstrap_distribution_major_version: "{{ bootstrap_facts.stdout_lines | join(',') | regex_replace( '^.*VERSION_ID=\"(\\d{1,2})(\\.\\d{1,4})*?\".*$','\\1') | default('NA') }}" loop: "{{ bootstrap_os_family_map | dict2items | map(attribute='value') | flatten }}" when: - bootstrap_facts.rc == 0 - bootstrap_distribution is not defined - bootstrap_facts.stdout is regex('PRETTY_NAME=.'~ bootstrap_search[item] | default(item) ~'.*') - name: set bootstrap facts (II) set_fact: bootstrap_os_family: "{{ item.key }}" loop: "{{ bootstrap_os_family_map | dict2items }}" loop_control: label: "{{ item.key }}" when: - bootstrap_distribution in item.value