build: upgrade to Ansible 14 (#13549)

Raise ansible-core support to 2.21 for maintained upstream support through November 2027. This requires Python 3.12-3.14 on control nodes and 3.9-3.14 on targets.

Signed-off-by: bo.jiang <bo.jiang@daocloud.io>
This commit is contained in:
ERIK
2026-09-26 15:18:27 +00:00
committed by GitHub
parent baf68247eb
commit 2dbb33a3d7
9 changed files with 27 additions and 19 deletions
+3
View File
@@ -1,4 +1,7 @@
--- ---
supported_ansible_also:
- '2.21.'
skip_list: skip_list:
# see https://docs.ansible.com/ansible-lint/rules/default_rules.html for a list of all default rules # see https://docs.ansible.com/ansible-lint/rules/default_rules.html for a list of all default rules
+2
View File
@@ -0,0 +1,2 @@
# astl v0.5.1 does not honor supported_ansible_also for this rule; ansible-lint validates it.
meta/runtime.yml meta-runtime[unsupported-version]
+5 -4
View File
@@ -34,12 +34,13 @@ repos:
- id: astl - id: astl
- repo: https://github.com/ansible/ansible-lint - repo: https://github.com/ansible/ansible-lint
rev: v25.11.0 rev: v26.9.0
hooks: hooks:
- id: ansible-lint - id: ansible-lint
language_version: python3
stages: [manual] stages: [manual]
additional_dependencies: additional_dependencies:
- ansible-core>=2.18.0,<2.19.0 - ansible-core>=2.21.0,<2.22.0
- jmespath==1.0.1 - jmespath==1.0.1
- netaddr==1.3.0 - netaddr==1.3.0
- distlib - distlib
@@ -58,7 +59,7 @@ repos:
name: Build and install kubernetes-sigs.kubespray Ansible collection name: Build and install kubernetes-sigs.kubespray Ansible collection
language: python language: python
additional_dependencies: additional_dependencies:
- ansible-core>=2.18.0,<2.19.0 - ansible-core>=2.21.0,<2.22.0
- distlib - distlib
entry: tests/scripts/collection-build-install.sh entry: tests/scripts/collection-build-install.sh
pass_filenames: false pass_filenames: false
@@ -100,7 +101,7 @@ repos:
name: Update static files referencing default kubespray values name: Update static files referencing default kubespray values
language: python language: python
additional_dependencies: additional_dependencies:
- ansible-core>=2.18.0,<2.19.0 - ansible-core>=2.21.0,<2.22.0
entry: scripts/propagate_ansible_variables.yml entry: scripts/propagate_ansible_variables.yml
pass_filenames: false pass_filenames: false
+1 -1
View File
@@ -151,7 +151,7 @@ Note:
- **Minimum required version of Kubernetes is v1.35.0** - **Minimum required version of Kubernetes is v1.35.0**
- **Ansible v2.14+, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands** - **Ansible 14 (ansible-core 2.21), Jinja 3.1+ and python-netaddr are installed on the machine that will run Ansible commands**
- The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](docs/operations/offline-environment.md)) - The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](docs/operations/offline-environment.md))
- The target servers are configured to allow **IPv4 forwarding**. - The target servers are configured to allow **IPv4 forwarding**.
- If using IPv6 for pods and services, the target servers are configured to allow **IPv6 forwarding**. - If using IPv6 for pods and services, the target servers are configured to allow **IPv6 forwarding**.
+8 -8
View File
@@ -2,8 +2,8 @@
## Installing Ansible ## Installing Ansible
Kubespray supports multiple ansible versions and ships different `requirements.txt` files for them. Kubespray pins its supported Ansible version in `requirements.txt`.
Depending on your available python version you may be limited in choosing which ansible version to use. Your available Python version may limit which Ansible version you can use.
It is recommended to deploy the ansible version used by kubespray into a python virtual environment. It is recommended to deploy the ansible version used by kubespray into a python virtual environment.
@@ -19,20 +19,20 @@ pip install -r requirements.txt
In case you have a similar message when installing the requirements: In case you have a similar message when installing the requirements:
```ShellSession ```ShellSession
ERROR: Could not find a version that satisfies the requirement ansible==7.6.0 (from -r requirements.txt (line 1)) (from versions: [...], 6.7.0) ERROR: Could not find a version that satisfies the requirement ansible==14.4.0 (from -r requirements.txt (line 1)) (from versions: [...])
ERROR: No matching distribution found for ansible==7.6.0 (from -r requirements.txt (line 1)) ERROR: No matching distribution found for ansible==14.4.0 (from -r requirements.txt (line 1))
``` ```
It means that the version of Python you are running is not compatible with the version of Ansible that Kubespray supports. It means that the version of Python you are running is not compatible with the version of Ansible that Kubespray supports.
If the latest version supported according to pip is 6.7.0 it means you are running Python 3.8 or lower while you need at least Python 3.9 (see the table below). Ansible 14 supports Python 3.12 through 3.14 on the Ansible control node (see the table below).
### Ansible Python Compatibility ### Ansible Python Compatibility
Based on the table below and the available python version for your ansible host you should choose the appropriate ansible version to use with kubespray. Based on the table below and the available python version for your ansible host you should choose the appropriate ansible version to use with kubespray.
| Ansible Version | Python Version | | ansible-core Version | Control Node Python Version | Target Node Python Version |
|-------------------|----------------| |----------------------|-----------------------------|----------------------------|
| >=2.19.0, <2.20.0 | 3.11-3.13 | | >=2.21.0, <2.22.0 | 3.12-3.14 | 3.9-3.14 |
## Customize Ansible vars ## Customize Ansible vars
+4 -2
View File
@@ -79,9 +79,11 @@ The following is an example of setting up and running kubespray using `vagrant`.
Customize your settings as shown, above, then run the commands: Customize your settings as shown, above, then run the commands:
```ShellSession ```ShellSession
# use virtualenv to install all python requirements # python3 must be version 3.12 through 3.14
$ python3 --version
# use venv to install all Python requirements
VENVDIR=venv VENVDIR=venv
$ virtualenv --python=/usr/bin/python3.7 $VENVDIR $ python3 -m venv $VENVDIR
$ source $VENVDIR/bin/activate $ source $VENVDIR/bin/activate
$ pip install -r requirements.txt $ pip install -r requirements.txt
+1 -1
View File
@@ -1,2 +1,2 @@
--- ---
requires_ansible: ">=2.19.0,<2.20.0" requires_ansible: ">=2.21.0,<2.22.0"
+2 -2
View File
@@ -5,8 +5,8 @@
become: false become: false
run_once: true run_once: true
vars: vars:
minimal_ansible_version: 2.19.0 minimal_ansible_version: 2.21.0
maximal_ansible_version: 2.20.0 maximal_ansible_version: 2.22.0
tags: always tags: always
tasks: tasks:
- name: "Check {{ minimal_ansible_version }} <= Ansible version < {{ maximal_ansible_version }}" - name: "Check {{ minimal_ansible_version }} <= Ansible version < {{ maximal_ansible_version }}"
+1 -1
View File
@@ -1,4 +1,4 @@
ansible==12.3.0 ansible==14.4.0
# Prevented passlib version conflicts # Prevented passlib version conflicts
bcrypt<6 bcrypt<6
# Needed for community.crypto module # Needed for community.crypto module