|
|
|
@ -4,6 +4,55 @@
|
|
|
|
|
- name: integration/interpreter_discovery/ansible_2_8_tests.yml
|
|
|
|
|
hosts: test-targets
|
|
|
|
|
gather_facts: true
|
|
|
|
|
vars:
|
|
|
|
|
DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_lt_2_12:
|
|
|
|
|
centos:
|
|
|
|
|
'6': /usr/bin/python
|
|
|
|
|
'7': /usr/bin/python
|
|
|
|
|
'8': /usr/libexec/platform-python
|
|
|
|
|
debian:
|
|
|
|
|
'9': /usr/bin/python
|
|
|
|
|
'10': /usr/bin/python3
|
|
|
|
|
'11': /usr/bin/python
|
|
|
|
|
'NA': /usr/bin/python # Debian 11, Ansible <= 7 (ansible-core <= 2.14)
|
|
|
|
|
'bullseye/sid': /usr/bin/python # Debian 11, Ansible 8 - 9 (ansible-core 2.15 - 2.16)
|
|
|
|
|
ubuntu:
|
|
|
|
|
'16': /usr/bin/python3
|
|
|
|
|
'18': /usr/bin/python3
|
|
|
|
|
'20': /usr/bin/python3
|
|
|
|
|
|
|
|
|
|
DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_2_12_to_2_16:
|
|
|
|
|
centos:
|
|
|
|
|
'6': /usr/bin/python
|
|
|
|
|
'7': /usr/bin/python
|
|
|
|
|
'8': /usr/libexec/platform-python
|
|
|
|
|
debian:
|
|
|
|
|
'9': /usr/bin/python
|
|
|
|
|
'10': /usr/bin/python3
|
|
|
|
|
'11': /usr/bin/python3.9
|
|
|
|
|
'NA': /usr/bin/python3.9 # Debian 11, Ansible <= 7 (ansible-core <= 2.14)
|
|
|
|
|
'bullseye/sid': /usr/bin/python3.9 # Debian 11, Ansible 8 - 9 (ansible-core 2.15 - 2.16)
|
|
|
|
|
ubuntu:
|
|
|
|
|
'16': /usr/bin/python3
|
|
|
|
|
'18': /usr/bin/python3
|
|
|
|
|
'20': /usr/bin/python3
|
|
|
|
|
|
|
|
|
|
DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_ge_2_17:
|
|
|
|
|
debian:
|
|
|
|
|
'10': /usr/bin/python3.7
|
|
|
|
|
'11': /usr/bin/python3.9
|
|
|
|
|
'bullseye/sid': /usr/bin/python3.9
|
|
|
|
|
ubuntu:
|
|
|
|
|
'20': /usr/bin/python3.8
|
|
|
|
|
|
|
|
|
|
discovered_interpreter_expected: >-
|
|
|
|
|
{%- if ansible_version.full is version('2.12', '<', strict=True) -%}
|
|
|
|
|
{{ DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_lt_2_12[distro][distro_major] }}
|
|
|
|
|
{%- elif ansible_version.full is version('2.17', '<', strict=True) -%}
|
|
|
|
|
{{ DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_2_12_to_2_16[distro][distro_major] }}
|
|
|
|
|
{%- else -%}
|
|
|
|
|
{{ DISCOVERED_INTERPRETER_EXPECTED_MAP__ANSIBLE_ge_2_17[distro][distro_major] }}
|
|
|
|
|
{%- endif -%}
|
|
|
|
|
tasks:
|
|
|
|
|
- name: can only run these tests on ansible >= 2.8.0
|
|
|
|
|
block:
|
|
|
|
@ -18,9 +67,9 @@
|
|
|
|
|
|
|
|
|
|
- name: snag some facts to validate for later
|
|
|
|
|
set_fact:
|
|
|
|
|
distro: '{{ ansible_distribution | default("unknown") | lower }}'
|
|
|
|
|
distro_version: '{{ ansible_distribution_version | default("unknown") }}'
|
|
|
|
|
os_family: '{{ ansible_os_family | default("unknown") }}'
|
|
|
|
|
distro: '{{ ansible_facts.distribution | lower }}'
|
|
|
|
|
distro_major: '{{ ansible_facts.distribution_major_version }}'
|
|
|
|
|
system: '{{ ansible_facts.system }}'
|
|
|
|
|
|
|
|
|
|
- name: test that python discovery is working and that fact persistence makes it only run once
|
|
|
|
|
block:
|
|
|
|
@ -159,50 +208,19 @@
|
|
|
|
|
- ansible_facts['ansible_bogus_interpreter'] | default('nope') == 'nope'
|
|
|
|
|
- ansible_facts['discovered_interpreter_bogus'] | default('nope') == 'nope'
|
|
|
|
|
|
|
|
|
|
- name: fedora assertions
|
|
|
|
|
- name: Check discovered interpreter matches expected
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3'
|
|
|
|
|
fail_msg: auto_out={{auto_out}}
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == discovered_interpreter_expected
|
|
|
|
|
fail_msg: >-
|
|
|
|
|
distro={{ distro }}
|
|
|
|
|
distro_major= {{ distro_major }}
|
|
|
|
|
system={{ system }}
|
|
|
|
|
auto_out={{ auto_out }}
|
|
|
|
|
discovered_interpreter_expected={{ discovered_interpreter_expected }}
|
|
|
|
|
ansible_version.full={{ ansible_version.full }}
|
|
|
|
|
when:
|
|
|
|
|
- distro == 'fedora'
|
|
|
|
|
- distro_version is version('23.0', '>=', strict=True)
|
|
|
|
|
|
|
|
|
|
- name: rhel < 8 assertions
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
|
|
|
|
|
fail_msg: auto_out={{auto_out}}
|
|
|
|
|
when:
|
|
|
|
|
- distro in ('redhat', 'centos')
|
|
|
|
|
- distro_version is version('8.0', '<', strict=true)
|
|
|
|
|
|
|
|
|
|
- name: rhel 8+ assertions
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == '/usr/libexec/platform-python'
|
|
|
|
|
fail_msg: auto_out={{auto_out}}
|
|
|
|
|
when:
|
|
|
|
|
- distro in ('redhat', 'centos')
|
|
|
|
|
- distro_version is version('8.0', '>=', strict=true)
|
|
|
|
|
|
|
|
|
|
- name: ubuntu < 16.04 assertions
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
|
|
|
|
|
fail_msg: auto_out={{auto_out}}
|
|
|
|
|
when:
|
|
|
|
|
- distro == 'ubuntu'
|
|
|
|
|
- distro_version is version('16.04', '<', strict=true)
|
|
|
|
|
|
|
|
|
|
- name: ubuntu 16.04+ assertions
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- auto_out.ansible_facts.discovered_interpreter_python == '/usr/bin/python3'
|
|
|
|
|
fail_msg: auto_out={{auto_out}}
|
|
|
|
|
when:
|
|
|
|
|
- distro == 'ubuntu'
|
|
|
|
|
- distro_version is version('16.04', '>=', strict=True)
|
|
|
|
|
- system in ['Linux']
|
|
|
|
|
|
|
|
|
|
always:
|
|
|
|
|
- meta: clear_facts
|
|
|
|
|