Starting with commit commit d76f41ece09b9aaf492553fe466c30a22c78e509 Author: Andrea Bolognani <abologna@xxxxxxxxxx> Date: Fri Mar 27 17:21:26 2020 +0100 lcitool: Include paths in the inventory Figuring them out at runtime is neat, but in practice they don't change frequently enough for it to be necessary; more importantly, including them in the inventory means we can use them in the Dockerfile generator in addition to the Ansible playbooks. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> we have hardcoded the path of the Python interpreter to be used for builds in the inventory; an unforeseen consequence of this change is that Python builds on CentOS 7 have started failing. The reason for that is simple, but not immediately obvious. While on most target platforms we have a single Python interpreter installed, on CentOS 7 we still need two: Python 3 works fine when it comes to building projects, but it's missing a bunch of modules that Ansible needs to run, so we're stuck with Python 2 for Ansible use. This has worked fine for us so far. As part of the change above, however, due to a naming clash we have ended up in a situation where the bootstrap task, which installs a Python suitable for Ansible, overrides the Python intended for builds as set in the inventory. Of course this would result in breakages only on CentOS 7, where the two Pythons differ. Fix this by removing the runtime detection from the bootstrap task and storing the relevant information in the inventory. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- guests/host_vars/libvirt-centos-7/main.yml | 1 + guests/host_vars/libvirt-centos-8/main.yml | 1 + guests/host_vars/libvirt-debian-10/main.yml | 1 + guests/host_vars/libvirt-debian-9/main.yml | 1 + guests/host_vars/libvirt-debian-sid/main.yml | 1 + guests/host_vars/libvirt-fedora-30/main.yml | 1 + guests/host_vars/libvirt-fedora-31/main.yml | 1 + guests/host_vars/libvirt-fedora-rawhide/main.yml | 1 + guests/host_vars/libvirt-freebsd-11/main.yml | 1 + guests/host_vars/libvirt-freebsd-12/main.yml | 1 + guests/host_vars/libvirt-freebsd-current/main.yml | 1 + guests/host_vars/libvirt-opensuse-151/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1604/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1804/main.yml | 1 + guests/playbooks/update/tasks/bootstrap.yml | 11 +---------- 15 files changed, 15 insertions(+), 10 deletions(-) diff --git a/guests/host_vars/libvirt-centos-7/main.yml b/guests/host_vars/libvirt-centos-7/main.yml index f1fef44..104b702 100644 --- a/guests/host_vars/libvirt-centos-7/main.yml +++ b/guests/host_vars/libvirt-centos-7/main.yml @@ -30,4 +30,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python2 ansible_python_interpreter: /usr/bin/python2 diff --git a/guests/host_vars/libvirt-centos-8/main.yml b/guests/host_vars/libvirt-centos-8/main.yml index 48edb78..441802c 100644 --- a/guests/host_vars/libvirt-centos-8/main.yml +++ b/guests/host_vars/libvirt-centos-8/main.yml @@ -30,4 +30,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-debian-10/main.yml b/guests/host_vars/libvirt-debian-10/main.yml index 37036e6..e3aca55 100644 --- a/guests/host_vars/libvirt-debian-10/main.yml +++ b/guests/host_vars/libvirt-debian-10/main.yml @@ -32,4 +32,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-debian-9/main.yml b/guests/host_vars/libvirt-debian-9/main.yml index b46efd1..0599aa4 100644 --- a/guests/host_vars/libvirt-debian-9/main.yml +++ b/guests/host_vars/libvirt-debian-9/main.yml @@ -32,4 +32,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-debian-sid/main.yml b/guests/host_vars/libvirt-debian-sid/main.yml index 36045cd..565b0be 100644 --- a/guests/host_vars/libvirt-debian-sid/main.yml +++ b/guests/host_vars/libvirt-debian-sid/main.yml @@ -32,4 +32,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-fedora-30/main.yml b/guests/host_vars/libvirt-fedora-30/main.yml index 71b8e7b..d31a84a 100644 --- a/guests/host_vars/libvirt-fedora-30/main.yml +++ b/guests/host_vars/libvirt-fedora-30/main.yml @@ -45,4 +45,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-fedora-31/main.yml b/guests/host_vars/libvirt-fedora-31/main.yml index c692715..389cfac 100644 --- a/guests/host_vars/libvirt-fedora-31/main.yml +++ b/guests/host_vars/libvirt-fedora-31/main.yml @@ -33,4 +33,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-fedora-rawhide/main.yml b/guests/host_vars/libvirt-fedora-rawhide/main.yml index bea4ad1..374cb4c 100644 --- a/guests/host_vars/libvirt-fedora-rawhide/main.yml +++ b/guests/host_vars/libvirt-fedora-rawhide/main.yml @@ -33,4 +33,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-freebsd-11/main.yml b/guests/host_vars/libvirt-freebsd-11/main.yml index 7fbab39..c289221 100644 --- a/guests/host_vars/libvirt-freebsd-11/main.yml +++ b/guests/host_vars/libvirt-freebsd-11/main.yml @@ -31,4 +31,5 @@ python: /usr/local/bin/python3 su: /usr/bin/su sudoers: /usr/local/etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/local/bin/python3 diff --git a/guests/host_vars/libvirt-freebsd-12/main.yml b/guests/host_vars/libvirt-freebsd-12/main.yml index abedd95..3bc3cc6 100644 --- a/guests/host_vars/libvirt-freebsd-12/main.yml +++ b/guests/host_vars/libvirt-freebsd-12/main.yml @@ -31,4 +31,5 @@ python: /usr/local/bin/python3 su: /usr/bin/su sudoers: /usr/local/etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/local/bin/python3 diff --git a/guests/host_vars/libvirt-freebsd-current/main.yml b/guests/host_vars/libvirt-freebsd-current/main.yml index 9b0ba1f..02297e0 100644 --- a/guests/host_vars/libvirt-freebsd-current/main.yml +++ b/guests/host_vars/libvirt-freebsd-current/main.yml @@ -31,4 +31,5 @@ python: /usr/local/bin/python3 su: /usr/bin/su sudoers: /usr/local/etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/local/bin/python3 diff --git a/guests/host_vars/libvirt-opensuse-151/main.yml b/guests/host_vars/libvirt-opensuse-151/main.yml index 3e674cc..656de36 100644 --- a/guests/host_vars/libvirt-opensuse-151/main.yml +++ b/guests/host_vars/libvirt-opensuse-151/main.yml @@ -31,4 +31,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-ubuntu-1604/main.yml b/guests/host_vars/libvirt-ubuntu-1604/main.yml index 1eb2345..476d7ed 100644 --- a/guests/host_vars/libvirt-ubuntu-1604/main.yml +++ b/guests/host_vars/libvirt-ubuntu-1604/main.yml @@ -31,4 +31,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/host_vars/libvirt-ubuntu-1804/main.yml b/guests/host_vars/libvirt-ubuntu-1804/main.yml index c9515b6..5a1ffcf 100644 --- a/guests/host_vars/libvirt-ubuntu-1804/main.yml +++ b/guests/host_vars/libvirt-ubuntu-1804/main.yml @@ -32,4 +32,5 @@ python: /usr/bin/python3 su: /bin/su sudoers: /etc/sudoers +ansible_python_package: python3 ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/playbooks/update/tasks/bootstrap.yml b/guests/playbooks/update/tasks/bootstrap.yml index 2e1dc42..410fe66 100644 --- a/guests/playbooks/update/tasks/bootstrap.yml +++ b/guests/playbooks/update/tasks/bootstrap.yml @@ -4,14 +4,5 @@ when: - package_format == 'pkg' -- set_fact: - python: python3 - -- set_fact: - python: python2 - when: - - os_name == 'CentOS' - - os_version == '7' - - name: Bootstrap Ansible - raw: '{{ package_manager }} install -y {{ python }}' + raw: '{{ package_manager }} install -y {{ ansible_python_package }}' -- 2.25.1