public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/8] Define Ansible inventory in the Ansible Configuration file
@ 2025-05-01 18:35 Daniel Gomez
  2025-05-01 18:35 ` [PATCH 1/8] playbooks: fix playbook name for all hosts plays Daniel Gomez
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Daniel Gomez @ 2025-05-01 18:35 UTC (permalink / raw)
  To: Luis Chamberlain, Chuck Lever; +Cc: kdevops, Daniel Gomez, Daniel Gomez

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>
---
Daniel Gomez (8):
      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

 .github/workflows/fstests.yml                      | 16 +++---
 Makefile                                           | 27 +++++-----
 Makefile.btrfs_progs                               |  4 +-
 Makefile.build_qemu                                | 12 ++---
 Makefile.hypervisor-tunings                        |  3 +-
 Makefile.kdevops                                   | 19 +++----
 Makefile.linux-mirror                              |  6 +--
 Makefile.postfix                                   |  3 +-
 kconfigs/Kconfig.ansible_cfg                       |  5 ++
 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 +-
 .../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 ++---
 103 files changed, 370 insertions(+), 293 deletions(-)
---
base-commit: 1e8f65cd4c4385e47c04356b701c101bd519adf2
change-id: 20250430-ansible_cfg_inventory-7955944ce8ff

Best regards,
-- 
Daniel Gomez <da.gomez@samsung.com>


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-05-03 18:58 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 18:35 [PATCH 0/8] Define Ansible inventory in the Ansible Configuration file Daniel Gomez
2025-05-01 18:35 ` [PATCH 1/8] playbooks: fix playbook name for all hosts plays Daniel Gomez
2025-05-01 18:35 ` [PATCH 2/8] playbooks: fix playbook name for localhost plays Daniel Gomez
2025-05-01 18:35 ` [PATCH 3/8] Makefile: use long form of limit argument for clarity Daniel Gomez
2025-05-01 18:35 ` [PATCH 4/8] Makefile: print target when debug Daniel Gomez
2025-05-01 18:35 ` [PATCH 5/8] .github/workflows/fstests.yml: enable make verbosity Daniel Gomez
2025-05-01 18:35 ` [PATCH 6/8] ansible_cfg: add inventory support Daniel Gomez
2025-05-01 19:41   ` Chuck Lever
2025-05-01 20:22     ` Daniel Gomez
2025-05-01 20:40       ` Chuck Lever
2025-05-01 21:50         ` Daniel Gomez
2025-05-01 18:35 ` [PATCH 7/8] gen_hosts: templates: add localhost to all hosts Daniel Gomez
2025-05-01 18:35 ` [PATCH 8/8] Makefile: use inventory from ansible.cfg Daniel Gomez
2025-05-02 16:34 ` [PATCH 0/8] Define Ansible inventory in the Ansible Configuration file Luis Chamberlain
2025-05-02 19:27   ` Daniel Gomez
2025-05-02 22:43     ` Luis Chamberlain
2025-05-02 22:45       ` Luis Chamberlain
2025-05-03 18:52         ` Daniel Gomez
2025-05-03 18:17       ` Daniel Gomez
2025-05-03 18:58         ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox