Align Kayobe Ansible version with Kolla Ansible

This change bumps up the maximum supported Ansible version to 10.x
(ansible-core 2.17.x) and minimum to 9.x. This synchronises Kayobe with
Kolla Ansible.

Change-Id: Idfbf0eed0b2333d550f822e40a0d96ae227f6159
This commit is contained in:
Will Szumski 2024-08-20 14:01:48 +01:00 committed by Pierre Riteau
parent 25d34ad365
commit f5d026badb
10 changed files with 58 additions and 10 deletions

View File

@ -7,6 +7,8 @@
name: epel-release name: epel-release
state: present state: present
become: True become: True
vars:
ansible_python_interpreter: /usr/bin/python3
when: when:
- ansible_facts.os_family == 'RedHat' - ansible_facts.os_family == 'RedHat'
- kolla_ansible_install_epel | bool - kolla_ansible_install_epel | bool
@ -18,6 +20,8 @@
state: present state: present
cache_valid_time: "{{ apt_cache_valid_time if ansible_facts.os_family == 'Debian' else omit }}" cache_valid_time: "{{ apt_cache_valid_time if ansible_facts.os_family == 'Debian' else omit }}"
update_cache: "{{ True if ansible_facts.os_family == 'Debian' else omit }}" update_cache: "{{ True if ansible_facts.os_family == 'Debian' else omit }}"
vars:
ansible_python_interpreter: /usr/bin/python3
become: True become: True
- name: Ensure source code checkout parent directory exists - name: Ensure source code checkout parent directory exists

View File

@ -17,6 +17,8 @@
policy: "{{ selinux_policy }}" policy: "{{ selinux_policy }}"
state: "{{ selinux_state }}" state: "{{ selinux_state }}"
register: selinux_result register: selinux_result
vars:
ansible_python_interpreter: /usr/bin/python3
become: True become: True
when: stat_result.stat.exists when: stat_result.stat.exists

View File

@ -141,10 +141,18 @@ function is_yum {
fi fi
} }
function get_python {
if is_dnf; then
echo python3.12
else
echo python3
fi
}
function install_dependencies { function install_dependencies {
echo "Installing package dependencies for kayobe" echo "Installing package dependencies for kayobe"
if is_dnf; then if is_dnf; then
sudo dnf -y install gcc git vim python3-devel python3-pyyaml libffi-devel sudo dnf -y install gcc git vim python3-devel python3-pyyaml libffi-devel python3.12-devel python3.12 python3.12-pyyaml
elif is_yum; then elif is_yum; then
echo "CentOS 7 is no longer supported" echo "CentOS 7 is no longer supported"
exit 1 exit 1
@ -166,7 +174,7 @@ function install_venv {
fi fi
if [[ ! -f "${venv_path}/bin/activate" ]]; then if [[ ! -f "${venv_path}/bin/activate" ]]; then
echo "Creating virtual environment in ${venv_path}" echo "Creating virtual environment in ${venv_path}"
python3 -m venv "${venv_path}" $(get_python) -m venv "${venv_path}"
# NOTE: Virtualenv's activate and deactivate scripts reference an # NOTE: Virtualenv's activate and deactivate scripts reference an
# unbound variable. # unbound variable.
set +u set +u
@ -192,7 +200,9 @@ function install_venv_system_site_packages {
fi fi
if [[ ! -f "${venv_path}/bin/activate" ]]; then if [[ ! -f "${venv_path}/bin/activate" ]]; then
echo "Creating virtual environment in ${venv_path}" echo "Creating virtual environment in ${venv_path}"
python3 -m venv --system-site-packages "${venv_path}" # NOTE(wszumski): tenks doesn't currently support not using the system python
# interpreter with: "Failed to detect selinux python bindings"
/usr/bin/python3 -m venv --system-site-packages "${venv_path}"
# NOTE: Virtualenv's activate and deactivate scripts reference an # NOTE: Virtualenv's activate and deactivate scripts reference an
# unbound variable. # unbound variable.
set +u set +u
@ -218,7 +228,9 @@ function install_kayobe_dev_venv {
function upgrade_kayobe_venv { function upgrade_kayobe_venv {
echo "Upgrading kayobe virtual environment in ${KAYOBE_VENV_PATH}" echo "Upgrading kayobe virtual environment in ${KAYOBE_VENV_PATH}"
python3 -m venv "${KAYOBE_VENV_PATH}" # NOTE(wszumski): We need to recreate the old virtualenv to switch to python3.12
rm -rf "${KAYOBE_VENV_PATH}"
$(get_python) -m venv "${KAYOBE_VENV_PATH}"
# NOTE: Virtualenv's activate and deactivate scripts reference an # NOTE: Virtualenv's activate and deactivate scripts reference an
# unbound variable. # unbound variable.
set +u set +u

View File

@ -14,6 +14,8 @@ source "${PARENT}/functions"
function main { function main {
config_init config_init
# NOTE(wszusmki): Dependencies such as python can change across versions
install_dependencies
overcloud_upgrade overcloud_upgrade
} }

View File

@ -13,6 +13,8 @@ source "${PARENT}/functions"
function main { function main {
config_init config_init
# NOTE(wszusmki): Dependencies such as python can change across versions
install_dependencies
seed_upgrade seed_upgrade
} }

View File

@ -8,14 +8,25 @@
name: python3 name: python3
become: true become: true
- name: Install Python3.12 on RHEL derivatives
dnf:
name:
- python3.12
- python3.12-devel
state: latest
when: ansible_facts.os_family == 'RedHat'
become: true
- name: Ensure testinfra is installed - name: Ensure testinfra is installed
vars:
cmd: "{{ 'python3.12' if ansible_facts.os_family == 'RedHat' else 'python3' }} -m venv"
pip: pip:
name: name:
- distro - distro
- pytest-testinfra - pytest-testinfra
- pytest-html - pytest-html
virtualenv: "{{ testinfra_venv }}" virtualenv: "{{ testinfra_venv }}"
virtualenv_command: python3 -m venv virtualenv_command: "{{ cmd }}"
# NOTE(mgoddard): Use the name zzz-overrides.yml to ensure this takes # NOTE(mgoddard): Use the name zzz-overrides.yml to ensure this takes
# precedence over the standard config files and zz-overrides.yml from # precedence over the standard config files and zz-overrides.yml from

View File

@ -0,0 +1,11 @@
---
upgrade:
- |
Python 3.9.x is no longer supported on the control host. On Rocky Linux 9,
please recreate your virtualenv with ``python3.12``.
- |
Updates the maximum supported version of Ansible from 9.x (ansible-core
2.16) to 10.x (ansible-core 2.17). The minimum supported version is updated
from 8.x to 9.x. On Rocky Linux 9, you will need to recreate your Kayobe
virtualenv using ``python3.12`` as support for ``python3.9`` has been
dropped.

View File

@ -1,10 +1,9 @@
pbr>=2.0 # Apache-2.0 pbr>=2.0 # Apache-2.0
Jinja2>3 # BSD Jinja2>3 # BSD
ansible>=8,<10 # GPLv3 ansible>=9,<11 # GPLv3
cliff>=3.1.0 # Apache cliff>=3.1.0 # Apache
netaddr!=0.7.16,>=0.7.13 # BSD netaddr!=0.7.16,>=0.7.13 # BSD
PyYAML>=3.10.0 # MIT PyYAML>=3.10.0 # MIT
selinux # MIT
# INI parsing # INI parsing
oslo.config>=5.2.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0
paramiko # LGPL paramiko # LGPL

View File

@ -6,7 +6,7 @@ description_file =
author = OpenStack author = OpenStack
author_email = openstack-discuss@lists.openstack.org author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/kayobe/latest/ home_page = https://docs.openstack.org/kayobe/latest/
python_requires = >=3.8 python_requires = >=3.10
license = Apache License, Version 2.0 license = Apache License, Version 2.0
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
@ -18,10 +18,9 @@ classifier =
Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
[files] [files]
packages = packages =

View File

@ -8,6 +8,9 @@
- release-notes-jobs-python3 - release-notes-jobs-python3
check: check:
jobs: jobs:
- openstack-tox-py39:
#NOTE(wszumski): We have dropped python3.9 support, so disable this job.
files: THIS-JOB-IS-DISABLED
- kayobe-tox-ansible-syntax - kayobe-tox-ansible-syntax
- kayobe-tox-ansible - kayobe-tox-ansible
- kayobe-tox-molecule - kayobe-tox-molecule
@ -33,6 +36,9 @@
- kayobe-infra-vm-ubuntu-noble - kayobe-infra-vm-ubuntu-noble
gate: gate:
jobs: jobs:
- openstack-tox-py39:
#NOTE(wszumski): We have dropped python3.9 support, so disable this job.
files: THIS-JOB-IS-DISABLED
- kayobe-tox-ansible-syntax - kayobe-tox-ansible-syntax
- kayobe-tox-ansible - kayobe-tox-ansible
- kayobe-tox-molecule - kayobe-tox-molecule