Skip to content

Commit d555b32

Browse files
authored
Merge pull request #88 from stackhpc/rl9-python3.12
Support using python3.12 on Rocky Linux 9
2 parents fa6beca + ea61ea1 commit d555b32

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ansible/deploy-openstack-config.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,22 @@
262262
become: true
263263
when: ansible_facts['distribution'] == "Ubuntu"
264264

265+
- name: Set a fact about the Python binary to use
266+
ansible.builtin.set_fact:
267+
python_binary: "{{ '/usr/bin/python3.12' if ansible_facts['distribution'] == 'Rocky' and (openstack_release.stdout.startswith('master') or openstack_release.stdout.startswith('2025')) else '/usr/bin/python3' }}"
268+
269+
- name: Ensure python3.12 is installed (Rocky)
270+
ansible.builtin.package:
271+
name: python3.12
272+
state: present
273+
become: true
274+
when: python_binary == '/usr/bin/python3.12'
275+
265276
- name: Ensure the latest version of pip is installed
266277
ansible.builtin.pip:
267278
name: pip
268279
virtualenv: "{{ ansible_env.HOME }}/venvs/kayobe"
269-
virtualenv_command: "/usr/bin/python3 -m venv"
280+
virtualenv_command: "{{ python_binary }} -m venv"
270281
state: latest
271282

272283
- name: Fix up `kayobe-config` requirements to point to requested version
@@ -280,7 +291,7 @@
280291
ansible.builtin.pip:
281292
requirements: "{{ src_directory }}/{{ kayobe_config_name }}/requirements.txt"
282293
virtualenv: "{{ ansible_env.HOME }}/venvs/kayobe"
283-
virtualenv_command: "/usr/bin/python3 -m venv"
294+
virtualenv_command: "{{ python_binary }} -m venv"
284295
state: present
285296

286297
- name: Ensure `kayobe` is installed (Yoga & earlier)

0 commit comments

Comments
 (0)