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 D2A991DF75C for ; Fri, 2 May 2025 12:13:44 +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=1746188024; cv=none; b=XM17jDy6HLvexfsjMZzJLieh9ytbsCTsLC6M5FWp4aN4FJ8Z4L7MTjtfFHiRvgNpGn+XDvm3uTz3ESz+EfNKo435dPxoPjgJeROWcRgEfUENxwS5K98DWEyohjpCNXbAGiQnULD0jKUuJ5jgfUbzG5hPLNHeUWAm/Y1CN2Lmkhw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746188024; c=relaxed/simple; bh=ViK92TUvCOKkZCiRDgMZoT3DzXsYiGg4LSyPjry0Blg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h/LSH3GV0YU/6CTe2DIqYi7ifwOVEnaOCw+En/V45VrkYKonHq/5hac9XHlSD2wk/4L9btUvjfkCFTMwjpVBQabr6IkiDzyZ/E7YWpdNSruanU1n544dwPju2FJLphIQentV9KXA86A6k/QwOnzPiB4vQtF+j3PUEXVN38G0WIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XVXuZU8Y; 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="XVXuZU8Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3CA7C4CEE4; Fri, 2 May 2025 12:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746188024; bh=ViK92TUvCOKkZCiRDgMZoT3DzXsYiGg4LSyPjry0Blg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XVXuZU8YJGEes2nyX7qezCJaDmN+abjiFaGY5+aDDpNfpZ1jLSnKK7XfDGYTVlnvk O+/JubK6fvp13kMi05WGW116TdxFfJPVnULrWUD5AHJTGBYIkW9eD0GztT+i5MiYyG LEulqDxSqeDTJj0kMu00L8hVvrt/QV1OVCGhHbkRyX9+ki/q3JktfKHHHI0TN/XZby Ur12XaeI1DXCQmtrlymJ/s8/MXvNGvKEtuQULHOnz2vUaARSNlzXswMJ704Vj8G5Sj G2PlsPYAFF4ibE4v0KHLqT1bSvDiQ7dQ+ItlddvQ+9nav+p0YlNg/WaTwlbX7EhHhb 5M2Oebqz0HQTw== From: Daniel Gomez Date: Fri, 02 May 2025 14:13:23 +0200 Subject: [PATCH v2 06/10] ansible_cfg: add inventory 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: <20250502-ansible_cfg_inventory-v2-6-d3c19ff4aa6e@samsung.com> References: <20250502-ansible_cfg_inventory-v2-0-d3c19ff4aa6e@samsung.com> In-Reply-To: <20250502-ansible_cfg_inventory-v2-0-d3c19ff4aa6e@samsung.com> To: Luis Chamberlain , Chuck Lever Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3920; i=da.gomez@samsung.com; h=from:subject:message-id; bh=bncyUcc5kofUGLeKZeDvSIYLvJtqb/OLvmuH7OQiwZw=; b=owEBbQKS/ZANAwAIAYX1bqTp6BOPAcsmYgBoFLbqbwpsp2IxbCzVPJ+NeoqTRCaiZ/7RJmy0z R5b0zL5wHCJAjMEAAEIAB0WIQSyp6nP3QO1QP9YsnGF9W6k6egTjwUCaBS26gAKCRCF9W6k6egT j5DwD/0V5+fpgBqNtBECmnpMNTk7TRhidpce8W309A7Bog15W7bIQe22yvS+yD5RAGg2bu6f+oe cFlt5e3jJsQuTg6n1RHlvxmbY0FdvOc9KywuJvoGUlmkufH1oE6cyYMwFzgRmL+x0lxs9iiC70J FfxY7y6mfrOVqyGhZxUMfOpJkCYgbQOKgPipJQFepTFjLoy9a6iI/FlAhr+tmEkeTMUxBPvVNfU Sk72rtfg0D3PBNlKbMxhT07RMhllb/RZkTmxHZkv6DaNXsNvoq8JA1vnC107f99B6S4VYTeBP5J vs0hKqt3oEOr7jllzPjczMB4iL1WBvtVGZUyWfX/ohOsHwgSbA4kTwYvHAi8TptN7XXOp7NllZx nlYY+AarhHdBKT4DVwb/zvn31mTiIwkHXBUdm3XZPCTlUpa2FoS4MHM/MSkqdL4VpeZmxD9xcSb tXP+Hej5fyaCmAouT6HWqZtUa/B83M5O9nMfUL2EoSX+0icqyAvgnIQ/cLAkq/52Xz2KTMrXn6m HcC9Uhe6MCgtUCtaMADsK7Jwc6L9B88bwNNviRnj9YgnYC5ckuv2PEtvD3SK5rYHpsSUX9N1q5n bOgSvgdTH86MM4SkcotztVoP3RPMzgpJWbFXEDktFP2EM25KuOhFsZmHqiuR3pJh73yNxa3Izah gJQj5qQsANaq18w== X-Developer-Key: i=da.gomez@samsung.com; a=openpgp; fpr=B2A7A9CFDD03B540FF58B27185F56EA4E9E8138F From: Daniel Gomez Allow to configure the inventory file (currently via KDEVOPS_HOSTFILE and KDEVOPS_HOSTS) via ansible.cfg. The Ansible inventory file [1][2][3] is used in all kdevops/Makefile ansible-playbook calls. Enable this configuration to the global Ansible configuration file (ansible.cfg) and allow to define the inventory via Kconfig. This will simplify the playbook invocation. [1] https://docs.ansible.com/ansible/latest/reference_appendices/ config.html#default-host-list [2] https://docs.ansible.com/ansible/latest/cli/ ansible-inventory.html#cmdoption-ansible-inventory-i [3] https://docs.ansible.com/ansible/latest/reference_appendices/ config.html#envvar-ANSIBLE_INVENTORY This has no effect yet, as all ansible-playbook calls currently specify the --inventory (-i) argument. The next commits will clean up the code and allow the inventory defined in ansible.cfg to take effect. Keep the ANSIBLE_CFG_ prefix to refer to the kdevops Ansible configuration module. This isn't part of the Ansible config file, but rather of the kdevops module that configures Ansible. Signed-off-by: Daniel Gomez --- kconfigs/Kconfig.ansible_cfg | 18 ++++++++++++++++++ kconfigs/Kconfig.ansible_provisioning | 6 ------ playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/kconfigs/Kconfig.ansible_cfg b/kconfigs/Kconfig.ansible_cfg index b587596bc8d5f1215fa8c006f32d941bea5288cc..d78ea7507632ae86481633e83a845e81e6f7ad92 100644 --- a/kconfigs/Kconfig.ansible_cfg +++ b/kconfigs/Kconfig.ansible_cfg @@ -207,6 +207,24 @@ config ANSIBLE_CFG_FORKS endif # !ANSIBLE_CFG_FORKS_CUSTOM +config ANSIBLE_CFG_INVENTORY + string "Ansible inventory sources" + output yaml + default "$(TOPDIR_PATH)/hosts" + help + Comma-separated list of Ansible inventory source paths. + + This is mapped to the [defaults] section of the Ansible configuration + file (ansible.cfg): + inventory = + + Each entry can be a path to an inventory file or directory, + such as: + /path/to/hosts,/path/to/inventory_dir + + For more details, refer to the Ansible documentation: + https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-host-list + if DISTRO_OPENSUSE config ANSIBLE_CFG_RECONNECTION_RETRIES diff --git a/kconfigs/Kconfig.ansible_provisioning b/kconfigs/Kconfig.ansible_provisioning index 63f04306e7b26f228defa9e50630f5ed07eaac37..4416d06754df3a9645fef15173e83e2279cfce1a 100644 --- a/kconfigs/Kconfig.ansible_provisioning +++ b/kconfigs/Kconfig.ansible_provisioning @@ -98,12 +98,6 @@ config KDEVOPS_DEVCONFIG_SYSTEMD_WATCHDOG_TIMEOUT_KEXEC endif # KDEVOPS_DEVCONFIG_ENABLE_SYSTEMD_WATCHDOG -config KDEVOPS_ANSIBLE_INVENTORY_FILE - string "The ansible inventory file to use" - default $(shell, scripts/append-makefile-vars.sh $(KDEVOPS_HOSTFILE)) - help - The file to use for the ansible inventory. - config HAVE_DISTRO_PREFERS_ANSIBLE_PYTHON2 bool default n diff --git a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 index 2bc916321f424ab93447af40eccef30911d27bb6..fddbab6d3a4dc03524a819b5b695336445ecb732 100644 --- a/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 +++ b/playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 @@ -10,6 +10,7 @@ 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 }} forks = {{ ansible_cfg_forks }} +inventory = {{ ansible_cfg_inventory }} {% if ansible_facts['distribution'] == 'openSUSE' %} [connection] retries = {{ ansible_cfg_reconnection_retries }} -- 2.49.0