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 2011D1DF271 for ; Mon, 1 Sep 2025 15:03:37 +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=1756739019; cv=none; b=BrxkvBm0d8UN4nuoeqS2oeQlqWzjmlSMWa9tcm2v1oKlfR0NNmNEKyZGZ94LqeIrf97D8g6NoHV3EjaZDYmDXsQ/Gnnd23WyV5n1T4AFjfcofPoZRU3KpuQshYiwGb4XMGGKKKGNFnGc+v6p196cmcX/MOUFaGvgpwRs0r3sgkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756739019; c=relaxed/simple; bh=lBVXUtdDq0k7/D2FmZWoG6CuEI2SPMEqbfWbWachlUw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cvXhYVZ2MHG4FrGFLlZ8ceR9+4IpKTrgE41s3wYfcg9SXrSDJDnWvhl+eKTWoH4ZBNVYY7+yrucRQINF1qiC0fM+Nyv/IQ8jhvpPwNsr8newYIvqPTXX+scIG09aPGAmm2K4Frq915oRA54VX5Tw9yaWsAzN8L0JwKLiYkwSlUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j3K6tWhk; 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="j3K6tWhk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FAA1C4CEF0; Mon, 1 Sep 2025 15:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756739017; bh=lBVXUtdDq0k7/D2FmZWoG6CuEI2SPMEqbfWbWachlUw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=j3K6tWhkb8rcrBiIdO0p9AFrZRsYp6Clpzqfyb0tvCeewEHfByAyLV1asXG6BvnCs VDa8A8Uk1Ii7c3409cdp/wXYznfdI5Ls4+UCJdMbm5critCtcknLHu/1af7gtnS04S Fv20nuhwntEeodXnMO71cbH4FjTIpXn7tmIrlriPhFylJpBXxas5VGcV3YXiponxM+ IpvlU5Wy2Hw/WUI+waauAZ2Utr61dPE/IxzkRL3ZfEPPd38kh6T7s9mC3vFboPMghg +KELaMGZJm9AyfkRbARG1Vp/RsoElg8QlXH+yL47/OWjuBimXvapSAQTInE6un0i09 vYc0Ad0RASYkA== Message-ID: Date: Mon, 1 Sep 2025 11:03:36 -0400 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 2/2] ansible.cfg: generate an ansible.cfg file in TOPDIR To: Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever References: <20250828202827.3253499-1-cel@kernel.org> <20250828202827.3253499-3-cel@kernel.org> <5f05bdbc-d13b-4e2f-829d-095a2df2a24c@kernel.org> Content-Language: en-US From: Chuck Lever Organization: kernel.org In-Reply-To: <5f05bdbc-d13b-4e2f-829d-095a2df2a24c@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 9/1/25 8:00 AM, Daniel Gomez wrote: > On 28/08/2025 22.28, Chuck Lever wrote: >> From: Chuck Lever >> >> I need an ansible.cfg that is generated by the Kconfig menu, but >> whose pathname is selected dynamically based on where kdevops is >> being run rather than having that path baked into the .config. > > I'm trying to review the previous conversation before these patches as well as > this series. Please, let me know if I'm understanding something wrong: > > I think what we need is not to have individual configuration paths (as we > have now) for ansible.cfg, inventory, etc. What we want is to have one sandbox > folder, our TOPDIR, and have our kdevops sandbox directory there. All files > generated and consumed by kdevops should then use that path. > > Would this work? Well I think that would work for my particular usage, however: If I'm reading between the lines of the Ansible pathname help texts, it appears that these settings can specify search paths, not a single file. In particular, the ANSIBLE_CFG_INVENTORY_FILE string is a comma- separated list. And, if ANSIBLE_CFG_FILE is an empty string, then there is a default set of locations /outside of/ the CWD that Ansible searches for a configuration. I'm not against your suggestion of specifying a sandbox pathname at all; that would be a good UX simplification. There are these details, though, and I don't have any suggestions about that at the moment. > See below: > > kdevops-tree $ make defconfig-selftest-xarray O=path/to/sandbox0 > # Now path/to/sandbox0 contains the generated .config, extra_vars.yml, etc > kdevops-tree $ make menuconfig O=path/to/sandbox0 > kdevops-tree $ make O=path/to/sandbox0 > kdevops-tree $ make bringup O=path/to/sandbox0 > ... > kdevops-tree $ make defconfig-tmpfs O=path/to/sandbox1 > ... > path/to/sandbox0 $ make linux > path/to/sandbox0 $ make selftests > path/to/sandbox0 $ make selftests-xarray > ... > path/to/sandbox1 $ make > path/to/sandbox1 $ make bringup > path/to/sandbox1 $ make linux > path/to/sandbox1 $ make fstests > path/to/sandbox1 $ make fstests-baseline > > To clarify: instead of letting users override individual file paths, we allow > customization of the topdir directory (with O=) where all files are created. > If O= is not passed, then PWD is assumed. I think it would still be useful to > support customizing individual files, but only relative to TOPDIR. That would > keep the structure cleaner, for example, using subdirectories for Ansible files, > kconfigs, SSH, virsh, and so on. > >> Signed-off-by: Chuck Lever >> --- >> Makefile | 8 ++++++++ >> kconfigs/Kconfig.ansible_cfg | 12 ++++++++++++ >> 2 files changed, 20 insertions(+) >> >> diff --git a/Makefile b/Makefile >> index b6fdbe67fc07..b014faa5632e 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -27,10 +27,15 @@ KDEVOPS_NODES_ROLE_TEMPLATE_DIR := $(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/tem >> export KDEVOPS_NODES_TEMPLATE := >> export KDEVOPS_MRPROPER := >> >> +ifeq (y,$(CONFIG_ANSIBLE_CFG_FILE_DEFAULT)) >> +ANSIBLE_CFG_FILE := $(TOPDIR_PATH)/ansible.cfg >> +export ANSIBLE_CONFIG := $(ANSIBLE_CFG_FILE) >> +else > > What I'm suggesting above is to always use this new option. And perhaps > keep ANSIBLE_CFG_FILE configurable but inside TOPDIR. For example: > ANSIBLE_CFG_FILE=ansible/ansible.cfg. > >> ifneq ($(strip $(CONFIG_ANSIBLE_CFG_FILE)),) >> ANSIBLE_CFG_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_FILE) | tr --delete '"') >> export ANSIBLE_CONFIG := $(ANSIBLE_CFG_FILE) >> endif >> +endif >> ANSIBLE_INVENTORY_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_INVENTORY) | tr --delete '"') >> >> KDEVOPS_INSTALL_TARGETS := >> @@ -86,6 +91,9 @@ CFLAGS += $(INCLUDES) >> ANSIBLE_EXTRA_ARGS += kdevops_version='$(PROJECTRELEASE)' >> ANSIBLE_EXTRA_ARGS += topdir_path_has_sha256sum='$(TOPDIR_PATH_HAS_SHA256SUM)' >> ANSIBLE_EXTRA_ARGS += topdir_path_sha256sum='$(TOPDIR_PATH_SHA256SUM)' >> +ifeq (y,$(CONFIG_ANSIBLE_CFG_FILE_DEFAULT)) >> +ANSIBLE_EXTRA_ARGS += ansible_cfg_file='$(ANSIBLE_CFG_FILE)' >> +endif >> >> export KDEVOPS_HOSTS_TEMPLATE := hosts.j2 >> >> diff --git a/kconfigs/Kconfig.ansible_cfg b/kconfigs/Kconfig.ansible_cfg >> index dbd189f5d19e..a44f760912cf 100644 >> --- a/kconfigs/Kconfig.ansible_cfg >> +++ b/kconfigs/Kconfig.ansible_cfg >> @@ -18,6 +18,16 @@ config ANSIBLE_CFG_INVENTORY_SET_BY_CLI >> bool >> default $(shell, scripts/check-cli-set-var.sh KDEVOPS_HOSTS) >> >> +config ANSIBLE_CFG_FILE_DEFAULT >> + bool "Use a sensible default location for the ansible.cfg file" >> + default N >> + help >> + When this option is set to Y, kdevops creates an ansible.cfg >> + in a sensible default location, using the settings defined >> + in this Kconfig menu. >> + >> +if !ANSIBLE_CFG_FILE_DEFAULT >> + > > I think we don't need this if you agree with the approach above. > >> config ANSIBLE_CFG_FILE >> string "Ansible configuration file" >> output yaml >> @@ -41,6 +51,8 @@ config ANSIBLE_CFG_FILE >> For more details, refer to the Ansible documentation: >> https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file >> >> +endif # ANSIBLE_CFG_FILE_DEFAULT >> + >> menu "Ansible Callback Plugin Configuration" >> choice >> prompt "Ansible Callback Plugin" -- Chuck Lever