* [PATCH 0/2] python interpreter in ansible.cfg
@ 2025-04-04 20:01 Daniel Gomez
2025-04-04 20:01 ` [PATCH 1/2] ansible_cfg: add python interpreter support Daniel Gomez
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-04-04 20:01 UTC (permalink / raw)
To: Daniel Gomez, Luis Chamberlain; +Cc: kdevops, Daniel Gomez
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/2] ansible_cfg: add python interpreter support
2025-04-04 20:01 [PATCH 0/2] python interpreter in ansible.cfg Daniel Gomez
@ 2025-04-04 20:01 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-04-04 20:01 UTC (permalink / raw)
To: Daniel Gomez, Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Ansible Python interpreter can be set globally in [defaults] section
of ansible.fg with the interpreter_python key. Add support for it in
Kconfig ansible_cfg and allow cli to overwrite the the value.
https://docs.ansible.com/ansible/latest/reference_appendices/
interpreter_discovery.html#interpreter-discovery
https://docs.ansible.com/ansible/latest/reference_appendices/
config.html#interpreter-python
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
kconfigs/Kconfig.ansible_cfg | 64 ++++++++++++++++++++++
playbooks/roles/ansible_cfg/defaults/main.yml | 1 +
.../roles/ansible_cfg/templates/ansible.cfg.j2 | 1 +
3 files changed, 66 insertions(+)
diff --git a/kconfigs/Kconfig.ansible_cfg b/kconfigs/Kconfig.ansible_cfg
index 7286b0fe502521835a2dada19b9d59207fc37b94..3d9b635abb7232f53c8537f60663c8f6e1f861fd 100644
--- a/kconfigs/Kconfig.ansible_cfg
+++ b/kconfigs/Kconfig.ansible_cfg
@@ -2,6 +2,10 @@ config ANSIBLE_CFG_CALLBACK_PLUGIN_SET_BY_CLI
bool
default $(shell, scripts/check-cli-set-var.sh ANSIBLE_CFG_CALLBACK_PLUGIN)
+config ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+ bool
+ default $(shell, scripts/check-cli-set-var.sh ANSIBLE_CFG_INTERPRETER_PYTHON)
+
menu "Ansible Callback Plugin Configuration"
choice
prompt "Ansible Callback Plugin"
@@ -108,6 +112,66 @@ config ANSIBLE_CFG_DEPRECATION_WARNINGS
Toggle to control the showing of deprecation warnings
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#deprecation-warnings
+menu "Ansible Python Interpreter"
+choice
+ prompt "Ansible Python Interpreter"
+ default ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_SILENT if !ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+ default ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM if ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO
+ bool "Ansible Python Interpreter: Auto"
+ help
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_LEGACY
+ bool "Ansible Python Interpreter: Auto Legacy"
+ help
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_LEGACY_CLIENT
+ bool "Ansible Python Interpreter: Auto Legacy Client"
+ help
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_SILENT
+ bool "Ansible Python Interpreter: Auto Silent"
+ help
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM
+ bool "Ansible Python Interpreter: Custom"
+ help
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+
+endchoice
+
+if ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM
+
+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/env python3" if !ANSIBLE_CFG_INTERPRETER_PYTHON_SET_BY_CLI
+
+endif # ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM
+
+config ANSIBLE_CFG_INTERPRETER_PYTHON_STRING
+ string
+ output yaml
+ default "auto" if ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO
+ default "auto_legacy" if ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_LEGACY
+ default "auto_legacy_client" if ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_LEGACY_CLIENT
+ default "auto_silent" if ANSIBLE_CFG_INTERPRETER_PYTHON_AUTO_SILENT
+ default ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM_NAME if ANSIBLE_CFG_INTERPRETER_PYTHON_CUSTOM
+ help
+ Path to the Python interpreter to be used for module execution on remote targets,
+ or an automatic discovery mode.
+ https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html#using-python-3-on-the-managed-machines-with-commands-and-playbooks
+ https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html#interpreter-discovery
+ https://docs.ansible.com/ansible/latest/reference_appendices/config.html#interpreter-python
+ https://docs.ansible.com/ansible/latest/reference_appendices/config.html#envvar-ANSIBLE_PYTHON_INTERPRETER
+
+endmenu
+
if DISTRO_OPENSUSE
config ANSIBLE_CFG_RECONNECTION_RETRIES
diff --git a/playbooks/roles/ansible_cfg/defaults/main.yml b/playbooks/roles/ansible_cfg/defaults/main.yml
index c98334aa8f81e397ce4950a84f108a21d78fc784..f8ec327a5a1687dff5791ee7c763b06939f718f4 100644
--- a/playbooks/roles/ansible_cfg/defaults/main.yml
+++ b/playbooks/roles/ansible_cfg/defaults/main.yml
@@ -8,3 +8,4 @@ ansible_cfg_callback_plugin_display_skipped_hosts: true
ansible_cfg_callback_plugin_show_custom_stats: false
ansible_cfg_callback_plugin_show_per_host_start: true
ansible_cfg_callback_plugin_show_task_path_on_failure: true
+ansible_cfg_interpreter_python: "auto_silent"
diff --git a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
index e13931b5ce97807365a0e0caa0db921a3b2930d7..666ee344901df064c81d8c5aaadc82af38a01897 100644
--- a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
+++ b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2
@@ -8,6 +8,7 @@ display_skipped_hosts = {{ ansible_cfg_callback_plugin_display_skipped_hosts }}
show_custom_stats = {{ ansible_cfg_callback_plugin_show_custom_stats }}
show_per_host_start = {{ ansible_cfg_callback_plugin_show_per_host_start }}
show_task_path_on_failure = {{ ansible_cfg_callback_plugin_show_task_path_on_failure }}
+interpreter_python = {{ ansible_cfg_interpreter_python_string }}
{% if ansible_facts['distribution'] == 'openSUSE' %}
[connection]
retries = {{ ansible_cfg_reconnection_retries }}
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Makefile: remove ansible_python_interpreter
2025-04-04 20:01 [PATCH 0/2] python interpreter in ansible.cfg Daniel Gomez
2025-04-04 20:01 ` [PATCH 1/2] ansible_cfg: add python interpreter support Daniel Gomez
@ 2025-04-04 20:01 ` Daniel Gomez
2025-04-04 23:39 ` [PATCH 0/2] python interpreter in ansible.cfg Luis Chamberlain
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Gomez @ 2025-04-04 20:01 UTC (permalink / raw)
To: Daniel Gomez, Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
We can now set the Python Interpreter globally in the ansible.cfg and
with Kconfig or cli. Drop support for the calls where ansible-playbook
was specifying the interpreter with ansible_python_interpreter inventory
variable.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Makefile | 2 --
Makefile.build_qemu | 4 ----
Makefile.hypervisor-tunings | 1 -
Makefile.kdevops | 21 +++++++--------------
Makefile.linux-mirror | 2 --
Makefile.postfix | 1 -
scripts/archive.Makefile | 1 -
scripts/dynamic-pci-kconfig.Makefile | 3 +--
scripts/guestfs.Makefile | 14 +++++---------
| 1 -
scripts/journal-server.Makefile | 3 +--
scripts/kconfig-ansible.Makefile | 1 +
scripts/systemd-timesync.Makefile | 3 +--
scripts/terraform.Makefile | 8 ++------
scripts/vagrant.Makefile | 6 ++----
15 files changed, 20 insertions(+), 51 deletions(-)
diff --git a/Makefile b/Makefile
index fed5761f26ee0b234e9bf6bf1b664cfb54af4da6..e92c4e100a988dc2a8d66e59ef3f0df5566c81e6 100644
--- a/Makefile
+++ b/Makefile
@@ -228,7 +228,6 @@ $(KDEVOPS_HOSTS): .config ansible.cfg $(KDEVOPS_HOSTS_TEMPLATE)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/gen_hosts.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
DEFAULT_DEPS += $(KDEVOPS_NODES)
@@ -236,7 +235,6 @@ $(KDEVOPS_NODES) $(KDEVOPS_VAGRANT): .config ansible.cfg $(KDEVOPS_NODES_TEMPLAT
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/gen_nodes.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
DEFAULT_DEPS += $(LOCALHOST_SETUP_WORK)
diff --git a/Makefile.build_qemu b/Makefile.build_qemu
index 2c011e6f459821e9d19fcb1db1a8079880234290..72e1cba4dfbccccf8c546c613b788a26be86ee3f 100644
--- a/Makefile.build_qemu
+++ b/Makefile.build_qemu
@@ -23,7 +23,6 @@ qemu: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
PHONY += qemu
@@ -31,7 +30,6 @@ qemu-install: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml --tags vars,install
PHONY += qemu-install
@@ -39,7 +37,6 @@ qemu-configure: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml --tags vars,configure
PHONY += qemu-configure
@@ -47,7 +44,6 @@ qemu-build: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml --tags vars,build
PHONY += qemu-build
diff --git a/Makefile.hypervisor-tunings b/Makefile.hypervisor-tunings
index 19712b858a64d4863d4cfb28ee165aa8d56da1e1..39547c02f1b68a5bfb4ea770f37e4d3563109532 100644
--- a/Makefile.hypervisor-tunings
+++ b/Makefile.hypervisor-tunings
@@ -17,7 +17,6 @@ kdevops_hypervisor_tunning: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/hypervisor-tuning.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
PHONY += kdevops_hypervisor_tunning
diff --git a/Makefile.kdevops b/Makefile.kdevops
index 9a284338cda2ad57a881d6cdb7fd8029263f65f2..2c36dce47eb11fb1b736f0405b7f1f9303ae4d40 100644
--- a/Makefile.kdevops
+++ b/Makefile.kdevops
@@ -11,28 +11,24 @@ PHONY := kdevops_all
kdevops_terraform_deps:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml
PHONY += kdevops_terraform_deps
kdevops_vagrant_install_vagrant:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant.yml
kdevops_install_libvirt:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "skip_configuration=True" \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "skip_configuration=True"
kdevops_configure_libvirt:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "skip_install=True" \
- -e 'running_user=$(USER)' \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ -e 'running_user=$(USER)'
kdevops_vagrant_deps: \
kdevops_vagrant_install_vagrant \
@@ -45,16 +41,14 @@ KDEVOPS_VAGRANT_WORK := kdevops_vagrant_deps
kdevops_vagrant_boxes:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant_boxes.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant_boxes.yml
PHONY += kdevops_vagrant_boxes
KDEVOPS_VAGRANT_WORK += kdevops_vagrant_boxes
kdevops_verify_libvirt_user:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "only_verify_user=True" \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "only_verify_user=True"
PHONY += kdevops_verify_libvirt_user
KDEVOPS_VAGRANT_WORK += kdevops_verify_libvirt_user
@@ -62,8 +56,7 @@ KDEVOPS_VAGRANT_WORK += kdevops_verify_libvirt_user
kdevops_libvirt_storage_pool_create:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_storage_pool_create.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/libvirt_storage_pool_create.yml
PHONY += kdevops_libvirt_storage_pool_create
KDEVOPS_VAGRANT_WORK += kdevops_libvirt_storage_pool_create
diff --git a/Makefile.linux-mirror b/Makefile.linux-mirror
index 54d6539157600fae0b91f414ad766692e3bf73c3..6961a55b47ce0796b39841ae125f52f07f11a96f 100644
--- a/Makefile.linux-mirror
+++ b/Makefile.linux-mirror
@@ -29,7 +29,6 @@ kdevops_linux_mirror: $(KDEVOPS_EXTRA_VARS)
--inventory localhost, \
--tags vars,mirror \
$(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
PHONY += kdevops_linux_mirror
@@ -42,7 +41,6 @@ mirror-status: $(KDEVOPS_EXTRA_VARS)
--inventory localhost, \
--tags vars,mirror-status \
$(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
PHONY += mirror-status
diff --git a/Makefile.postfix b/Makefile.postfix
index 38fd90b2c88377554947f4cd6b7b50bccf2b29be..5db23dc973711dfbd697d5b353e64e257c8f1d0d 100644
--- a/Makefile.postfix
+++ b/Makefile.postfix
@@ -10,7 +10,6 @@ kdevops_postfix_setup_relay: $(KDEVOPS_EXTRA_VARS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/postfix_relay_host.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
PHONY += kdevos_postfix_setup_relay
ANSIBLE_EXTRA_ARGS += $(POSTFIX_SETUP_ARGS)
diff --git a/scripts/archive.Makefile b/scripts/archive.Makefile
index 56c936e941986c97268655b477863cf6d15849ab..54928d328472bb89e03ea0b11c259dbfabbe1c09 100644
--- a/scripts/archive.Makefile
+++ b/scripts/archive.Makefile
@@ -16,7 +16,6 @@ ci-archive:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/kdevops_archive.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars '{ $(ARCHIVE_DYNAMIC_RUNTIME_VARS) }' \
--extra-vars=@./extra_vars.yaml
endif
diff --git a/scripts/dynamic-pci-kconfig.Makefile b/scripts/dynamic-pci-kconfig.Makefile
index 0878f267e9098413060f8edac3b109d60637015c..716cdc1e4814a26532c8bb3550670cdd1e4caf3a 100644
--- a/scripts/dynamic-pci-kconfig.Makefile
+++ b/scripts/dynamic-pci-kconfig.Makefile
@@ -45,8 +45,7 @@ dynamic_pcipassthrough_kconfig:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/gen-pci-kconfig.yml \
- --extra-vars '{ $(PCIE_RUNTIME_VARS) }' \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ --extra-vars '{ $(PCIE_RUNTIME_VARS) }'
dynamic-kconfig-pci-help:
@echo "dynconfig-pci - enables only pci dynamically generated kconfig content"
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index e1cf25d62d0492fe0a27f382041529b4b5439324..3dad6a14f0c5a50cb06d06285bac3b66ca490962 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -54,26 +54,24 @@ KDEVOPS_PROVISION_DESTROY_METHOD := destroy_guestfs
libvirt_pcie_passthrough_permissions:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- playbooks/libvirt_pcie_passthrough.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ playbooks/libvirt_pcie_passthrough.yml
$(KDEVOPS_PROVISIONED_SSH):
$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/update_ssh_config_guestfs.yml \
- --extra-vars=@./extra_vars.yaml \
- -e 'ansible_python_interpreter=/usr/bin/python3' ;\
- LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) $(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
+ --extra-vars=@./extra_vars.yaml; \
+ LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) \
+ $(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
fi
- $(Q)ansible $(ANSIBLE_VERBOSE) -i hosts all -e 'ansible_python_interpreter=/usr/bin/python3' -m wait_for_connection
+ $(Q)ansible $(ANSIBLE_VERBOSE) -i hosts all -m wait_for_connection
$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
install_libguestfs:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/bringup_guestfs.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml \
--tags install-deps
@@ -81,14 +79,12 @@ bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/bringup_guestfs.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml \
--tags config-check,network,storage-pool-path
$(Q)$(TOPDIR)/scripts/bringup_guestfs.sh
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
playbooks/bringup_guestfs.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml \
--tags console-permissions
PHONY += bringup_guestfs
--git a/scripts/install-menuconfig-deps.Makefile b/scripts/install-menuconfig-deps.Makefile
index 25fdbbc95658ef9e9812baf5a7089c3abe8959ff..772e65df2528d1fdd191b7fad4ae68ebe0e35979 100644
--- a/scripts/install-menuconfig-deps.Makefile
+++ b/scripts/install-menuconfig-deps.Makefile
@@ -4,7 +4,6 @@ menuconfig-deps:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/install-menuconfig-deps.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
-e 'kdevops_first_run=True'
PHONY += menuconfig-deps
diff --git a/scripts/journal-server.Makefile b/scripts/journal-server.Makefile
index 49455f626b787c0359a171f65f454040733ff8cf..493c768b63212b6d249abacb93395a509ae5348e 100644
--- a/scripts/journal-server.Makefile
+++ b/scripts/journal-server.Makefile
@@ -20,8 +20,7 @@ journal-client:
journal-server:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_journal_remote.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_journal_remote.yml
journal-restart:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
diff --git a/scripts/kconfig-ansible.Makefile b/scripts/kconfig-ansible.Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/scripts/kconfig-ansible.Makefile
@@ -0,0 +1 @@
+
diff --git a/scripts/systemd-timesync.Makefile b/scripts/systemd-timesync.Makefile
index be6f0ab2321b1f6e844309ae5d1442df3d5d182d..f62edc0c7e57bac1de031b350247e0e810e117d5 100644
--- a/scripts/systemd-timesync.Makefile
+++ b/scripts/systemd-timesync.Makefile
@@ -29,8 +29,7 @@ timesyncd-client:
timesyncd-server:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- $(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_timesyncd.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ $(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_timesyncd.yml
timesyncd-status:
$(Q)timedatectl status
diff --git a/scripts/terraform.Makefile b/scripts/terraform.Makefile
index 02d2af51d8a3c8212eb75f3e37308d387ce2c6ee..fdef2e8c53b494a5ae37168f761f4429773f43a6 100644
--- a/scripts/terraform.Makefile
+++ b/scripts/terraform.Makefile
@@ -159,15 +159,13 @@ bringup_terraform:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--connection=local --inventory localhost, \
playbooks/terraform.yml --tags bringup \
- --extra-vars=@./extra_vars.yaml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ --extra-vars=@./extra_vars.yaml
$(KDEVOPS_PROVISIONED_SSH):
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-i $(KDEVOPS_HOSTFILE) \
playbooks/terraform.yml --tags ssh \
- --extra-vars=@./extra_vars.yaml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ --extra-vars=@./extra_vars.yaml
$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
status_terraform:
@@ -178,12 +176,10 @@ destroy_terraform:
--connection=local -i $(KDEVOPS_HOSTFILE) \
playbooks/terraform.yml --tags destroy \
--extra-vars=@./extra_vars.yaml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
$(Q)rm -f $(KDEVOPS_PROVISIONED_SSH) $(KDEVOPS_PROVISIONED_DEVCONFIG)
$(KDEVOPS_TFVARS): $(KDEVOPS_TFVARS_TEMPLATE) .config
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/gen_tfvars.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' \
--extra-vars=@./extra_vars.yaml
diff --git a/scripts/vagrant.Makefile b/scripts/vagrant.Makefile
index 664c8f9cfc5c9ac879c5c7a6dd6414d0add848db..fc69fb91f53f591ee9156aedc78d28d559b8b835 100644
--- a/scripts/vagrant.Makefile
+++ b/scripts/vagrant.Makefile
@@ -91,15 +91,13 @@ vagrant_9p_linux_clone:
libvirt_pcie_passthrough_permissions:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- playbooks/libvirt_pcie_passthrough.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3'
+ playbooks/libvirt_pcie_passthrough.yml
$(KDEVOPS_PROVISIONED_SSH):
$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
--inventory localhost, \
- playbooks/update_ssh_config_vagrant.yml \
- -e 'ansible_python_interpreter=/usr/bin/python3' ;\
+ playbooks/update_ssh_config_vagrant.yml
fi
$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] python interpreter in ansible.cfg
2025-04-04 20:01 [PATCH 0/2] python interpreter in ansible.cfg Daniel Gomez
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 ` Luis Chamberlain
2 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2025-04-04 23:39 UTC (permalink / raw)
To: Daniel Gomez; +Cc: Daniel Gomez, kdevops
On Fri, Apr 04, 2025 at 08:01:14PM +0000, Daniel Gomez wrote:
> 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:
Nice!
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-04 23:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04 20:01 [PATCH 0/2] python interpreter in ansible.cfg Daniel Gomez
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox