CI: Use auto-detected python interpreter except on CentOS 7

This switches to python 3 as the remote python interpreter on
Debian/Ubuntu jobs, with CentOS 7 as the only exception using python 2.

Also switch to auto-detection of the interpeter except for CentOS 7,
which should be based on the one used by ansible-playbook (python 3).

Change-Id: Ie4aff6123dfc7267fe78f4bd736565fb72fe135e
Partially-Implements: python-3
This commit is contained in:
Mark Goddard 2020-02-06 13:25:19 +00:00
parent 287adab05e
commit 5b38fbfc23

View File

@ -1,9 +1,11 @@
---
# Force the use of python2 on Ubuntu/Debian and CentOS7 remote hosts. This is
# necessary for delegate_to: localhost, which will otherwise use the local
# python interpreter (python3). On CentOS 7, that fails due to a lack of
# python3 bindings for SELinux. https://bugs.centos.org/view.php?id=16389
ansible_python_interpreter: /usr/bin/python{{ '2' if ansible_os_family != 'RedHat' or ansible_distribution_major_version == '7' else '3' }}
{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' %}
# Force the use of python2 on CentOS7 remote hosts. This is necessary for
# delegate_to: localhost, which will otherwise use the local python interpreter
# (python3). On CentOS 7, that fails due to a lack of python3 bindings for
# SELinux. https://bugs.centos.org/view.php?id=16389
ansible_python_interpreter: /usr/bin/python2
{% endif %}
kolla_base_distro: "{{ base_distro }}"
kolla_install_type: "{{ install_type }}"