Files
Michal Arbet 1f22f59e45 Improve virtualenv handling and pip installation for SDK roles
Ensure consistent and automatic creation of virtual environments
when defined. Replaced manual `packaging` installation with pip
module usage for better idempotency.
Improved pip binary detection by deriving it from the Python
executable, avoiding hardcoded 'pip3' which can point to diferrent
pip version (pip3.9 instead of pip3.12 for example).

Changes affect both docker_sdk and podman_sdk roles:
- Automatically install both `pip` and `packaging` in the virtualenv.
- Use ansible_facts.python.executable to build pip path dynamically.

This improves compatibility and reduces complexity.

Needed-By: https://review.opendev.org/c/openstack/kolla-ansible/+/949812

Change-Id: Ib361383bc320182e4d1ca0aa4fd4d5017215ea58
2025-05-18 13:41:28 +02:00

57 lines
1.8 KiB
YAML

---
# List of RPM/APT packages to install.
podman_sdk_packages_default:
- "python3-setuptools"
- "python3-pip"
- "{% if podman_sdk_python_externally_managed | default(false) and virtualenv is none %}python3-podman{% endif %}"
- "{% if podman_sdk_python_externally_managed | default(false) and virtualenv is none %}python3-dbus{% endif %}"
# List of Python packages to install via Pip.
# NOTE(kevko) podman 4.7.0 is built in debian as apt package, so..
podman_sdk_core_pip_packages:
- "podman>=4.7.0"
podman_sdk_additional_pip_packages:
- "dbus-python"
podman_sdk_packages_dbus_deps_redhat:
- "gcc"
- "python3-devel"
- "dbus-glib-devel"
- "dbus-daemon"
podman_sdk_packages_dbus_deps_debian:
- "build-essential"
- "python3-dev"
- "libdbus-glib-1-dev"
podman_sdk_packages: >-
{{ podman_sdk_packages_default +
(lookup('vars', 'podman_sdk_packages_dbus_deps_' ~ ansible_facts.os_family | lower)
if not (podman_sdk_python_externally_managed | default(false) and virtualenv is none) else []) }}
# APT cache TTL in seconds.
apt_cache_valid_time: 3600
# Path to a virtualenv in which to install python packages. If None, a
# virtualenv will not be used.
virtualenv:
# Whether the virtualenv will inherit packages from the global site-packages
# directory. This is typically required for modules such as yum and apt which
# are not available on PyPI.
virtualenv_site_packages: true
create_kolla_user: false
kolla_user: "kolla"
# Owner of the virtualenv.
podman_sdk_virtualenv_owner: "{{ kolla_user if create_kolla_user | bool else omit }}"
# A pip constraints file to use when installing the Podman API bindings.
podman_sdk_upper_constraints_file:
podman_sdk_osbpo_apt_url: "http://osbpo.debian.net/debian"
# Default action when handling packages will be install
package_action: "install"