public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
	 Chuck Lever <chuck.lever@oracle.com>
Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@kernel.org>,
	 Daniel Gomez <da.gomez@samsung.com>
Subject: [PATCH v2 00/10] Define Ansible inventory in the Ansible Configuration file
Date: Fri, 02 May 2025 14:13:17 +0200	[thread overview]
Message-ID: <20250502-ansible_cfg_inventory-v2-0-d3c19ff4aa6e@samsung.com> (raw)

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 <da.gomez@samsung.com>
---
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 <da.gomez@samsung.com>


             reply	other threads:[~2025-05-02 12:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 12:13 Daniel Gomez [this message]
2025-05-02 12:13 ` [PATCH v2 01/10] playbooks: fix playbook name for all hosts plays Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 02/10] playbooks: fix playbook name for localhost plays Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 03/10] Makefile: use long form of limit argument for clarity Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 04/10] Makefile: print target when debug Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 05/10] .github/workflows/fstests.yml: enable make verbosity Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 06/10] ansible_cfg: add inventory support Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 07/10] gen_hosts: templates: add localhost to all hosts Daniel Gomez
2025-05-02 18:56   ` Chuck Lever
2025-05-03 17:45     ` Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 08/10] Makefile: use inventory from ansible.cfg Daniel Gomez
2025-05-02 13:47   ` Daniel Gomez
2025-05-02 16:08     ` Chuck Lever
2025-05-02 19:11       ` Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 09/10] ansible_cfg: add support to change ansible.cfg file location Daniel Gomez
2025-05-02 12:13 ` [PATCH v2 10/10] docs: ansible_cfg: add documentation Daniel Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250502-ansible_cfg_inventory-v2-0-d3c19ff4aa6e@samsung.com \
    --to=da.gomez@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox