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 CF9381DF75C for ; Fri, 2 May 2025 12:13:36 +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=1746188016; cv=none; b=rQpzkvFgV40oBD6tX3EzcMI/N7ZBoygU/kj+1ckz0CM6Wbs7kn+ihrDI50+RmVfrGlydT88EFRoGV9N0JcHLNEdagGm8BW3Ug48lyql4A0mwYss/fsLZ5v3xKzBT85GYgY1Wkk9/yrjuexPQVNEI3047qzFplP1IgL9RERbNhIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746188016; c=relaxed/simple; bh=CTfl9OAw1G+w+N2IiHVTMUSa1Bbubtv4KGCKajC/C3k=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=dYOLjH7D9yId5VU7fJr2xZxErKnvVHm3BdZa1JyGF+io+GXDUfN36+itTzcZ4Jfv4dyR1hh8u8kx41twzq5BUsZthiECHPCpQ0frcHxxdGP/B/wWQa3bLKCTMb5laGALNYrVIp2meEcWp1wQEEs2vM4/vVfAL6G2tgcM+4lozPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aymfTsYu; 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="aymfTsYu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AE25C4CEE4; Fri, 2 May 2025 12:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746188016; bh=CTfl9OAw1G+w+N2IiHVTMUSa1Bbubtv4KGCKajC/C3k=; h=From:Subject:Date:To:Cc:From; b=aymfTsYugSDnoi2cO6AAGE3I/Y1aIIk107rInuaSyum+Sh3me34JlJ5tIrw6E3eNE YlXT0xWe2eJ/j882ZE6S2Qdx34cA6vqzc0m/6mgNzxyPPLzIpJ8BsYPcz1sCtBsndb 5uDhFLjM9+tszaUeko5qWWS3LkqLKHL14T8x4yS6G/8pLN/gcbgX9xJx5c9kCd1PEj m2tk/JjHBWuukyM3+XL0F06oI8a3Cj1p4hjK6nbkWEUpZdT409OSjHErYV8upd41Rf zoCOLy0QuTEmjV8/6cydFdw+KlXWHThQOD+Kx4+j+rw9ZBkFufEyIWUvcDxUPpWcKC 6KTzDpzTzpIYw== From: Daniel Gomez Subject: [PATCH v2 00/10] Define Ansible inventory in the Ansible Configuration file Date: Fri, 02 May 2025 14:13:17 +0200 Message-Id: <20250502-ansible_cfg_inventory-v2-0-d3c19ff4aa6e@samsung.com> 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 X-B4-Tracking: v=1; b=H4sIAN22FGgC/3WNwQ6CMBBEf4Xs2ZpSqAIn/8MQUuoWNpFiutpoC P9uwbPHN5l5swBjIGRosgUCRmKafQJ1yMCOxg8o6JYYlFRaloUUxjP1d+ysGzryEf1zDh9xrrW uy9Ji5Ryk7SOgo/fuvbaJR+Ktt9/EfEt/Ri3zP8aYCymsPlV9b0yhpbqwmfjlh6OdJ2jXdf0CW BbwB7wAAAA= X-Change-ID: 20250430-ansible_cfg_inventory-7955944ce8ff 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=10215; i=da.gomez@samsung.com; h=from:subject:message-id; bh=CTfl9OAw1G+w+N2IiHVTMUSa1Bbubtv4KGCKajC/C3k=; b=owEBbQKS/ZANAwAIAYX1bqTp6BOPAcsmYgBoFLbk37EJf+3lI26PmOoPJZr1OgkUTeUQjdrfp ptwBBqT2reJAjMEAAEIAB0WIQSyp6nP3QO1QP9YsnGF9W6k6egTjwUCaBS25AAKCRCF9W6k6egT j1H/D/0d4u35oCBsggjFXK4hyn28iwoK3SGbJPgo7t9imeUH7hJBuFUMOESzXx1qBGaV1Q38g1q JU+OmXrTD+VSFkS2+oTZME067kG3F8LRfTpkKDoP8dZanJcR879eVdbdRpitd2e/NLybfJfA8kW WB7XHBC3kiMhSDdPfz+SFoiXS6G++miLNuIvEUF4BOBKcRBGKxMeIAuXMpDNFdozY3IIN22kgld YOuaJSd+i8scYkBjwYQCHkRR0jqtdMj6fjdGNK2rR4NIQ4ueTSPn4W/E6l0qkbumh3zm2HtWhTa dWTjWgyznjgYhctnw4jVH1D0IW3xiJUh+pYPLjzkMaEEhbGq6nsttJVRd3lk+YpjTEWZaFimKPK fm98XF+HSC2aFqyc+hZymOuiUGslOSEowh+AkPVl0OAyDVgXOzYLRBerramA1kXPkSDQJWWvhmQ knc5eKpdDhvoibbPqxsBxBBsDHxKqOaemqeUzVQxXPEfFJzCt1yJ+q88SN1MO1AW2jL+rv1Mex7 z39YwMSc6stHV81f+SKr1cUSxZJ+Y2jmVrmq3HxxlTdGKO01FSBPHUuVp9xPcoRlvUJeDkO87Al qoz8CI2NlX9Bu88bFs2LPbrSHo1xu13zKhkP9MoX0LxYMyv9WevTk97X8eq/hwmW+0QzIjLtisJ j4lUEyDzg4imJhw== X-Developer-Key: i=da.gomez@samsung.com; a=openpgp; fpr=B2A7A9CFDD03B540FF58B27185F56EA4E9E8138F This promotes the Ansible inventory file (typically 'hosts' in kdevops) to the Ansible Configuration file (ansible.cfg). By doing this, we allow to control the hosts globally rather than in all the ansible-playbook commands, as well as clean up the ansible-playbook command. So, we don't need to define anymore the inventory file in the command. However, playbooks may still be controlled on which targets the playbook is run. This is done through the playbook itself and/or through the ansible-playbook argument --limit. As part of the series, the term 'all' to refer to all hosts is redefined to include the localhost. This removes the need to be explicit with localhost playbooks runs, as it's now just another target in the inventory file. This term redefinition requires to change playbooks that use the term all, either through ansible-playbook command or through the host: field in the YAML playbook file. For this reason, the term has been replaced in most cases with 'all:!localhost', which means all targets in the inventory file except the localhost. Except the bootlinux.yml playbook, all playbooks run either on localhost or remote targets (the previous all definition). Therefore, all playbooks have been converted to use 'hosts: all!localhost'. For the bootlinux.yml playbook, all is kept and the control of host execution is done via the --limit argument. It was found that only the linux-clone-9p target runs the bootlinux playbook in the localhost while the rest of linux-* targets run the playbook in all the remotes (all:!localhosts). In addition, in order to help me debug this change, I found it convenient to print the Makefile target name being run before the command. This allows to be more explicit in verbose mode (V=1) when a playbook is run (or any subsequent command in the target). And makes it easier to discover which target the ansible-playbook command belongs to when debugging playbook execution. To clarify, V=1 already prints the command but not the Makefile target. The command output behaviour will be a bit different as it is today as the command itself will be printed in one line, instead of multiple. Series has been tested here: https://github.com/linux-kdevops/kdevops/actions/runs/14773869477 Signed-off-by: Daniel Gomez --- Changes in v2: - Update ANSIBLE_CFG_INVENTORY help description as per Chuck suggestion - Add docs/kdevops-ansible-configuration.md for extensive module documentation - Include fix to avoid generating always the ansible.cfg and hosts files. Reported by Chuck The same commit change also includes support to change the ansible.cfg path. - Link to v1: https://lore.kernel.org/r/20250501-ansible_cfg_inventory-v1-0-c568bbaa3502@samsung.com --- Daniel Gomez (10): playbooks: fix playbook name for all hosts plays playbooks: fix playbook name for localhost plays Makefile: use long form of limit argument for clarity Makefile: print target when debug .github/workflows/fstests.yml: enable make verbosity ansible_cfg: add inventory support gen_hosts: templates: add localhost to all hosts Makefile: use inventory from ansible.cfg ansible_cfg: add support to change ansible.cfg file location docs: ansible_cfg: add documentation .github/workflows/fstests.yml | 16 ++-- MAINTAINERS | 2 +- Makefile | 42 ++++----- Makefile.btrfs_progs | 4 +- Makefile.build_qemu | 12 +-- Makefile.hypervisor-tunings | 3 +- Makefile.kdevops | 19 ++-- Makefile.linux-mirror | 6 +- Makefile.postfix | 3 +- docs/kdevops-ansible-configuration.md | 102 +++++++++++++++++++++ kconfigs/Kconfig.ansible_cfg | 33 +++++++ kconfigs/Kconfig.ansible_provisioning | 6 -- playbooks/blktests.yml | 3 +- playbooks/bootlinux-local.yml | 3 +- playbooks/bootlinux.yml | 3 +- playbooks/bringup_guestfs.yml | 3 +- playbooks/build_qemu.yml | 3 +- playbooks/common.yml | 3 +- playbooks/create_data_partition.yml | 3 +- playbooks/cxl.yml | 3 +- playbooks/devconfig.yml | 3 +- playbooks/fstests.yml | 5 +- playbooks/gen-pci-kconfig.yml | 3 +- playbooks/gen_hosts.yml | 3 +- playbooks/gen_nodes.yml | 3 +- playbooks/gen_tfvars.yml | 3 +- playbooks/gitr.yml | 3 +- playbooks/hypervisor-tuning.yml | 3 +- playbooks/install-menuconfig-deps.yml | 3 +- playbooks/install_systemd_journal_remote.yml | 3 +- playbooks/install_systemd_timesyncd.yml | 3 +- playbooks/install_terraform.yml | 3 +- playbooks/install_vagrant_boxes.yml | 3 +- playbooks/iscsi.yml | 3 +- playbooks/kdc.yml | 3 +- playbooks/kdevops_archive.yml | 3 +- playbooks/krb5.yml | 3 +- playbooks/ktls.yml | 3 +- playbooks/libvirt_pcie_passthrough.yml | 3 +- playbooks/libvirt_storage_pool_create.yml | 3 +- playbooks/libvirt_user.yml | 3 +- playbooks/linux-mirror.yml | 3 +- playbooks/ltp.yml | 3 +- playbooks/nfsd.yml | 3 +- playbooks/nfstest.yml | 3 +- playbooks/pkg.yml | 3 +- playbooks/postfix_relay_host.yml | 3 +- playbooks/pynfs.yml | 3 +- playbooks/reboot-limit.yml | 3 +- playbooks/roles/ansible_cfg/tasks/main.yml | 2 +- .../roles/ansible_cfg/templates/ansible.cfg.j2 | 1 + playbooks/roles/gen_hosts/defaults/main.yml | 1 - playbooks/roles/gen_hosts/tasks/main.yml | 52 +++++------ playbooks/roles/gen_hosts/templates/blktests.j2 | 1 + playbooks/roles/gen_hosts/templates/cxl.j2 | 1 + playbooks/roles/gen_hosts/templates/fstests.j2 | 1 + playbooks/roles/gen_hosts/templates/gitr.j2 | 1 + playbooks/roles/gen_hosts/templates/hosts.j2 | 2 + playbooks/roles/gen_hosts/templates/ltp.j2 | 1 + playbooks/roles/gen_hosts/templates/nfstest.j2 | 1 + playbooks/roles/gen_hosts/templates/pynfs.j2 | 1 + playbooks/roles/gen_hosts/templates/selftests.j2 | 1 + playbooks/roles/gen_hosts/templates/sysbench.j2 | 1 + playbooks/roles/update_etc_hosts/tasks/main.yml | 2 +- playbooks/rxe.yml | 3 +- playbooks/selftests.yml | 3 +- playbooks/siw.yml | 3 +- playbooks/smbd.yml | 3 +- playbooks/sysbench.yml | 3 +- playbooks/terraform.yml | 3 +- playbooks/update_etc_hosts.yml | 3 +- playbooks/update_ssh_config_guestfs.yml | 3 +- playbooks/update_ssh_config_vagrant.yml | 3 +- scripts/archive.Makefile | 3 +- scripts/devconfig.Makefile | 8 +- scripts/dynamic-pci-kconfig.Makefile | 3 +- scripts/firstconfig.Makefile | 5 +- scripts/gen-hosts.Makefile | 1 - scripts/guestfs.Makefile | 17 ++-- scripts/install-menuconfig-deps.Makefile | 3 +- scripts/iscsi.Makefile | 2 +- scripts/journal-server.Makefile | 23 +++-- scripts/kotd.Makefile | 16 ++-- scripts/krb5.Makefile | 4 +- scripts/ktls.Makefile | 1 - scripts/nfsd.Makefile | 2 +- scripts/provision.Makefile | 5 +- scripts/rdma.Makefile | 2 - scripts/smbd.Makefile | 2 +- scripts/systemd-timesync.Makefile | 8 +- scripts/terraform.Makefile | 6 +- scripts/update_etc_hosts.Makefile | 2 +- scripts/vagrant.Makefile | 10 +- scripts/workflows/lib/crash.py | 4 +- workflows/blktests/Makefile | 20 ++-- workflows/common/Makefile | 2 +- workflows/cxl/Makefile | 14 +-- workflows/demos/reboot-limit/Makefile | 32 ++++--- workflows/fstests/Makefile | 40 +++++--- workflows/gitr/Makefile | 8 +- workflows/linux/Makefile | 61 +++++++----- workflows/ltp/Makefile | 8 +- workflows/nfstest/Makefile | 8 +- workflows/pynfs/Makefile | 12 +-- workflows/selftests/Makefile | 11 ++- workflows/sysbench/Makefile | 12 +-- 106 files changed, 510 insertions(+), 302 deletions(-) --- base-commit: 1e8f65cd4c4385e47c04356b701c101bd519adf2 change-id: 20250430-ansible_cfg_inventory-7955944ce8ff Best regards, -- Daniel Gomez