From 2e5dd3cc07881846265b855616a6181b135adff4 Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Thu, 6 Jan 2022 20:52:48 +0000 Subject: [PATCH] docs(readme): note about ansible_python_interpreter --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab5ab26..0c8752e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ and [CHANGELOG.md](CHANGELOG.md). The host you're running Ansible from requires the following Python dependencies: - - `python >= 3.6.0` + - `python >= 3.6.0` - [See Notes below](#important-node-about-python). - `ansible >= 2.9.16` or `ansible-base >= 2.10.4` You can install dependencies using the requirements.txt file in this repository: @@ -193,6 +193,36 @@ particularly with regards to privilege escalation. | `k3s_skip_env_checks` | Skip all tasks that check environment configuration. | `false` | | `k3s_become` | Escalate user privileges for tasks that need root permissions. | `false` | +#### Important note about Python + +From v3 of this role, Python 3 is required on the target system as well as on +the Ansible controller. This is to ensure consistent behaviour for Ansible +tasks as Python 2 is now EOL. + +If target systems have both Python 2 and Python 3 installed, it is most likely +that Python 2 will be selected by default. To ensure Python 3 is used on a +target with both versions of Python, ensure `ansible_python_interpreter` is +set in your inventory. Below is an example inventory: + +```yaml +--- + +k3s_cluster: + hosts: + kube-0: + ansible_user: ansible + ansible_host: 10.10.9.2 + ansible_python_interpreter: /usr/bin/python3 + kube-1: + ansible_user: ansible + ansible_host: 10.10.9.3 + ansible_python_interpreter: /usr/bin/python3 + kube-2: + ansible_user: ansible + ansible_host: 10.10.9.4 + ansible_python_interpreter: /usr/bin/python3 +``` + #### Important note about `k3s_release_version` If you do not set a `k3s_release_version` the latest version from the stable