Skip to content

Commit d016fd2

Browse files
keukopriteau
authored andcommitted
Fix compatibility with Kolla virtualenv configuration
This change updates how Kayobe handles Python virtual environments to ensure compatibility with the virtualenv handling used in kolla-ansible [1] and ansible-collection-kolla [2]. Summary: - Removes hardcoded 'ansible_python_interpreter' from templates. - Introduces support for the 'virtualenv' variable used by SDK roles. - Enables cleaner and more consistent interpreter selection. [1] https://review.opendev.org/c/openstack/kolla-ansible/+/949812 [2] https://review.opendev.org/c/openstack/ansible-collection-kolla/+/949767 Closes-Bug: #2111594 Change-Id: I7cfb600eec268749ea1315112fe3a9429ab3ab8e (cherry picked from commit 4e2220b)
1 parent 75d12c0 commit d016fd2

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

ansible/kayobe-target-venv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
vars:
8686
# Use the system python interpreter since the virtualenv might not
8787
# exist.
88-
ansible_python_interpreter: /usr/bin/python3
88+
ansible_python_interpreter: "{{ ansible_facts.python.executable }}"
8989
when: virtualenv is defined
9090

9191
# If we gathered facts earlier it would have been with a different Python

ansible/roles/kolla-ansible/templates/kolla/globals.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,14 @@ ironic_inspector_kernel_cmdline_extras:
505505
grafana_admin_username: "{{ grafana_local_admin_user_name }}"
506506
{% endif %}
507507

508+
###########################
509+
# Target python environment
510+
###########################
511+
{% if kolla_ansible_target_venv is not none %}
512+
# Execute ansible modules on the remote target hosts using a virtualenv.
513+
virtualenv: "{{ kolla_ansible_target_venv }}"
514+
{% endif %}
515+
508516
{% if kolla_extra_globals %}
509517
#######################
510518
# Extra configuration

ansible/roles/kolla-ansible/templates/overcloud-components.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ network
1111
compute
1212
storage
1313
monitoring
14+
bifrost
1415

1516
[tls-backend:children]
1617
control

ansible/roles/kolla-ansible/templates/overcloud-top-level.j2

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ ansible_user={{ kolla_ansible_user }}
2323
{% if kolla_ansible_become | bool %}
2424
ansible_become=true
2525
{% endif %}
26-
{% if kolla_ansible_target_venv is not none %}
27-
# Execute ansible modules on the remote target hosts using a virtualenv.
28-
ansible_python_interpreter={{ kolla_ansible_target_venv }}/bin/python
29-
{% endif %}
30-
3126

3227
{% for kolla_group, kolla_group_config in kolla_overcloud_inventory_top_level_group_map.items() %}
3328
{% if 'groups' in kolla_group_config %}

ansible/roles/kolla-ansible/templates/seed.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ansible_user={{ kolla_ansible_user }}
99
{% if kolla_ansible_target_venv is not none %}
1010
# Execute ansible modules on the remote target hosts using a virtualenv.
11-
ansible_python_interpreter={{ kolla_ansible_target_venv }}/bin/python
11+
virtualenv={{ kolla_ansible_target_venv }}
1212
{% endif %}
1313

1414
[baremetal:children]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes incorrect handling of ``ansible_python_interpreter`` when using
5+
``ansible-collection-kolla``. Kayobe now aligns its behavior with
6+
``kolla-ansible`` to ensure the correct interpreter is used.
7+
`LP#2111594 <https://bugs.launchpad.net/kayobe/+bug/2111594>`__

0 commit comments

Comments
 (0)