From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F75C221704 for ; Fri, 4 Apr 2025 20:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743796883; cv=none; b=qQXFYtELe/mWvYIT0qgWmD5qclGDSpFGsjI9PAfHZpRugRrORYo1RhgiHiaGC5zbuKoaq2gkSl/fEg9V7mM3hB6y3cXrYcqyuL+rSp8Yh/DDBjCWVwQehPZ7mPK/Ma4cvME8NEhIddfkf3KyoeI/eRZpUiszyFI7N8EBKRKDQmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743796883; c=relaxed/simple; bh=cs4dShw8FCa/ujzjawvaGDNMG62f0t0pLkhq6E/121E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lxGpzuyM4d8cp1g3FTC3cobcGDWv+1j4vDelOlKabMpPdRL3ZJi02OvqJE87MbDNFQoAGPzQX27p8x+pHSzKHPpNQQ+gLkwWQpRd1vWIhvDnzR2kEbXS968zgqQ6V+SKiu2eHXZkD8ENqgFpiVuE9/Gyho+nO4Ckw6gw+f4egmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PIOtAKUY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PIOtAKUY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5D83C4CEE4; Fri, 4 Apr 2025 20:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743796882; bh=cs4dShw8FCa/ujzjawvaGDNMG62f0t0pLkhq6E/121E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PIOtAKUYQJKTIGEIJNWQCKCMTeMPvr2GJShGjOmMSqtw9pVEFvCneiwCaJUMq9Y47 TUjMDBQROpn6krABp+sFHjB/wl3cL4bFuliLRlN+Lk1hfjakIE+xPGYQW8nscOYj0b 4XAD71HfmQo4xrUY9kLy8ao6DIjuEYCwhZRsdNpiHbWrb+LvYCcDetrXLT5BNetsql mUhqRvMiOXMPCf9EC2sBEG7rdfqdqfRgq93nIGw21mKS+1zGxvO8g6YKnieN8WkDFr DEOFWoj5vLJYr8uXS4j7lb+TaYEAkDfkL9Wgjk9NIrz9n4qcuCAxfxjRJbrDU/bUmk KhANpeZsoEo2A== From: Daniel Gomez Date: Fri, 04 Apr 2025 20:01:15 +0000 Subject: [PATCH 1/2] ansible_cfg: add python interpreter support Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250404-python-interpreter-v1-1-04783b627ce7@samsung.com> References: <20250404-python-interpreter-v1-0-04783b627ce7@samsung.com> In-Reply-To: <20250404-python-interpreter-v1-0-04783b627ce7@samsung.com> To: Daniel Gomez , Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez 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 --- 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