From: Daniel Gomez <da.gomez@kernel.org>
To: Daniel Gomez <da.gomez@samsung.com>,
Luis Chamberlain <mcgrof@kernel.org>
Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@kernel.org>
Subject: [PATCH 0/2] python interpreter in ansible.cfg
Date: Fri, 04 Apr 2025 20:01:14 +0000 [thread overview]
Message-ID: <20250404-python-interpreter-v1-0-04783b627ce7@samsung.com> (raw)
This adds support for the Ansible Python Interpreter [1] in Kconfig
and cli. Instead of setting the interpreter individually for every
task/target, just set it globally with the Ansible variable dedicated
for it (interpreter_python).
Set the default interpreter to auto_silent to silent the warning. From
documentation [2]:
"The fallback behavior will issue a warning that the interpreter
should be set explicitly (since interpreters installed later may change
which one is used). This warning behavior can be disabled by setting
auto_silent or auto_legacy_silent"
'auto_silent' will prevent this warning:
TASK [Gathering Facts]
[started TASK: Gathering Facts on localhost]
Warning: : Platform linux on host localhost is using the discovered
Python
ok: [localhost]
interpreter at /usr/bin/python3.13, but future installation of another
Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.18/reference_appendices/interpreter_discovery.html for more
information.
https://docs.ansible.com/ansible-core/2.18/reference_appendices/
interpreter_discovery.html
In addition, this allows setting a custom interpreter if a specific
distribution requires it, such as NixOS:
diff --git a/kconfigs/Kconfig.ansible_cfg b/kconfigs/Kconfig.ansible_cfg
index 0c29300..9172e42 100644
--- a/kconfigs/Kconfig.ansible_cfg
+++ b/kconfigs/Kconfig.ansible_cfg
@@ -116,7 +116,7 @@ menu "Ansible Python Interpreter"
choice
prompt "Ansible Python Interpreter"
default ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO if !ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
- default ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM if ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+ default ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM if ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI || DISTRO_NIXOS
config ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO
bool "Ansible Python Interpreter: Auto"
@@ -151,6 +151,7 @@ config ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM_NAME
string "Custom Ansible Python Interpreter Name"
default $(shell, ./scripts/append-makefile-vars.sh $(ANSIBLE_CFG_INTERPRETER_PYTHON)) if ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
default "/usr/bin/python3" if !ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+ default "/usr/local/env python3" if !ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI && DISTRO_NIXOS
endif # ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM
[1]
https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#interpreter-python
[2]
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#interpreter-python-fallback
To: Daniel Gomez <da.gomez@samsung.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: kdevops@lists.linux.dev
Cc: Daniel Gomez <da.gomez@kernel.org>
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Daniel Gomez (2):
ansible_cfg: add python interpreter support
Makefile: remove ansible_python_interpreter
Makefile | 2 -
Makefile.build_qemu | 4 --
Makefile.hypervisor-tunings | 1 -
Makefile.kdevops | 21 +++----
Makefile.linux-mirror | 2 -
Makefile.postfix | 1 -
kconfigs/Kconfig.ansible_cfg | 64 ++++++++++++++++++++++
playbooks/roles/ansible_cfg/defaults/main.yml | 1 +
.../roles/ansible_cfg/templates/ansible.cfg.j2 | 1 +
scripts/archive.Makefile | 1 -
scripts/dynamic-pci-kconfig.Makefile | 3 +-
scripts/guestfs.Makefile | 14 ++---
scripts/install-menuconfig-deps.Makefile | 1 -
scripts/journal-server.Makefile | 3 +-
scripts/kconfig-ansible.Makefile | 1 +
scripts/systemd-timesync.Makefile | 3 +-
scripts/terraform.Makefile | 8 +--
scripts/vagrant.Makefile | 6 +-
18 files changed, 86 insertions(+), 51 deletions(-)
---
base-commit: 41edfaca90249f4e7bd975a906f64340460d3dbf
change-id: 20250402-python-interpreter-cbb06a40c8ff
Best regards,
--
Daniel Gomez <da.gomez@samsung.com>
next reply other threads:[~2025-04-04 20:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 20:01 Daniel Gomez [this message]
2025-04-04 20:01 ` [PATCH 1/2] ansible_cfg: add python interpreter support Daniel Gomez
2025-04-04 20:01 ` [PATCH 2/2] Makefile: remove ansible_python_interpreter Daniel Gomez
2025-04-04 23:39 ` [PATCH 0/2] python interpreter in ansible.cfg Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250404-python-interpreter-v1-0-04783b627ce7@samsung.com \
--to=da.gomez@kernel.org \
--cc=da.gomez@samsung.com \
--cc=kdevops@lists.linux.dev \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox