Skip to contentSkip to conversation

Define Ansible inventory in the Ansible Configuration file

PATCH Applied Daniel Gomez 4 participants 20 messages Jul 24, 2025 – Jul 28, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

v5 cover Define Ansible inventory in the Ansible Configuration file

Following Chuck's proposed changes to make task parallelism configurable via the Ansible configuration file [1], and the subsequent cleanup of ansible-playbook calls [2] along with the Python interpreter improvements [3] to better support distros like NixOS through simplified global interpreter configuration [4], I considered applying the same approach to the inventory file. This would further streamline our Ansible wrapper in the kdevops Makefiles.

Why make this change? By specifying the inventory file (typically 'hosts' file in kdevops) directly in ansible.cfg, we eliminate the need for repeated -i/--inventory arguments and gain flexibility in where the inventory file is located. This also supports the broader sandboxing goal discussed in [5]. Moreover, by including localhost in the inventory, we can clean up the Makefile wrapper even further by removing --connection=localhost and -i localhost options, while also enabling workflows to run directly on the controller node (with some extra more modifications).

https://lore.kernel.org/kdevops/[email protected]/

[1]
Increase default task parallelism
https://lore.kernel.org/kdevops/[email protected]/
[2]
[PATCH 2/2] Makefile: Remove "-f 30" command line argument
https://lore.kernel.org/kdevops/[email protected]/

[3]
https://lore.kernel.org/kdevops/[email protected]/

[4]
https://lore.kernel.org/kdevops/kwpt5iizzmryybpg6z3fgs6koak27rjggydfighd42wn7mxqja@2hwvtppppzsk/

[5]
https://lore.kernel.org/kdevops/[email protected]/

This series 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. Also notice delegate_to is needed when the playbook runs and iterates on specific nodes such as baseline and dev but a specific task needs to be handled back to the controller node.

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 'baseline:dev', which means all targets in the inventory file in the baseline and dev groups, matching the 'all' concept in the former configuration 'hosts' file. Except the bootlinux.yml and guestfs.yml playbooks, all playbooks run either on localhost or remote targets (the previous 'all' definition). Therefore, all playbooks have been converted to use 'hosts: baseline:dev'. 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 (baseline:dev). For guestfs.yml, a combination of --limit + delegate_to is needed for the reason explained above: to iterate on the targets (baseline:dev) but delegate certain tags to the controller node with delegate_to.

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:
v1:
https://github.com/linux-kdevops/kdevops/actions/runs/14773869477
v3:
https://github.com/linux-kdevops/kdevops/actions/runs/14846101950
v4:
https://github.com/linux-kdevops/kdevops/actions/runs/16033723055
v5:
https://github.com/linux-kdevops/kdevops/actions/runs/16506085205

---
Changes in v5:
- Rebase on top of main as of 2025-07-24
- Update the new mmtests and stead_state Makefiles accordingly
- Test gitr and nfstest workflows with nfsd enabled
- Test pynfs workflow with iscsi service
- Fix spelling reported by Chuck
- Fix Ansible WARNING when generating ansible.cfg reported by Chuck.
Revert to specify inventory and target. After all, we can't leverage the
inventory in ansible.cfg as it's not generated yet
- Replace hosts field baseline:dev with iscsi in playbooks/iscsi.yml and
do the same for kdc, krb5 and nfsd, smbd playbooks. This also allows to
remove --limit from their ansible-playbook incantations
- Fix duplicate name field in playbooks/nfstest.yml
- Fix workflows that depend on nfsd, iscsi, smbd, kdc, krb5 guests by
introducing a new group "service", and use it for bringup operations and
SSH wait in $KDEVOPS_PROVISIONED_SSH (.provisioned_once_ssh) target.
Reported by Chuck
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Add trailers (from Luis)
- Rebase on top of main
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Fix LIMIT_HOSTS. When HOSTS="host1" was used, the --limit replacement
did not work anymore because of the quotes where not needed when using
long form arguments
- Fix bootlinux-local limit in linux target.
- Replace all:!localhost with baseline:dev as suggested by Luis. This
allows to include localhost as part of the baseline and/or dev groups
for baremetal workflows
- Allow to configure the ansible.cfg location. This requires to export
the ANSIBLE_CONFIG. This also enables sandboxing
- Fix debug mode when ansible.cfg is created (command was not printed
because of double @)
- Add back KDEVOPS_HOSTS as cli option. KDEVOPS_HOSTS was not part of
the cli before but it was allowed to be overwritten at command line
time. This allows to be explicit and keeps backwards compatibility with
the variable
- Extend ANSIBLE_CFG_FILE help as per Chuck's suggestion
- Move ANSIBLE_CFG_FILE location in Kconfig and place it after
SET_BY_CLI options
- Remove crash_watchdog.py inventory arguments (Reported by Luis)
- Remove inventory arguments from docs, READMEs and remaining Makefiles
- Move ueh_hosts hunk to fix undefined variable in patch "gen_hosts:
templates: add localhost to all hosts"
- Rename CONFIG_KDEVOPS_ANSIBLE_INVENTORY_FILE to CONFIG_ANSIBLE_CFG_INVENTORY
in scripts/lib.sh and kconfigs/Kconfig.ansible_provisioning
- Update cover letter reasoning and commit messages for better clarity
- Link to v2: https://lore.kernel.org/r/[email protected]

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/[email protected]

---
Daniel Gomez (12):
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: add service group to inventory templates
gen_hosts: templates: include localhost in the all group
Makefile: use inventory from ansible.cfg
ansible_cfg: add support to change ansible.cfg file location
docs: ansible_cfg: add documentation build.Makefile: fix verbosity of clean target

 .github/workflows/fstests.yml                      |  16 ++--
 MAINTAINERS                                        |   2 +-
 Makefile                                           |  41 +++++----
 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 +++++++++++++++++++++
 docs/kdevops-terraform.md                          |   2 +-
 kconfigs/Kconfig.ansible_cfg                       |  46 ++++++++++
 kconfigs/Kconfig.ansible_provisioning              |   8 +-
 playbooks/blktests.yml                             |   3 +-
 playbooks/bootlinux.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                              |   6 +-
 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         |   3 +-
 .../roles/ansible_cfg/templates/ansible.cfg.j2     |   1 +
 playbooks/roles/bootlinux/README.md                |  12 +--
 playbooks/roles/common/README.md                   |   2 +-
 playbooks/roles/devconfig/README.md                |   2 +-
 playbooks/roles/gen_hosts/defaults/main.yml        |   1 -
 playbooks/roles/gen_hosts/tasks/main.yml           |  54 +++++------
 playbooks/roles/gen_hosts/templates/blktests.j2    |   1 +
 playbooks/roles/gen_hosts/templates/cxl.j2         |   1 +
 playbooks/roles/gen_hosts/templates/fstests.j2     |  16 ++++
 playbooks/roles/gen_hosts/templates/gitr.j2        |  10 ++
 playbooks/roles/gen_hosts/templates/hosts.j2       |  11 +++
 playbooks/roles/gen_hosts/templates/ltp.j2         |   1 +
 playbooks/roles/gen_hosts/templates/nfstest.j2     |  10 ++
 playbooks/roles/gen_hosts/templates/pynfs.j2       |   8 ++
 playbooks/roles/gen_hosts/templates/selftests.j2   |   1 +
 playbooks/roles/gen_hosts/templates/sysbench.j2    |   1 +
 playbooks/roles/guestfs/tasks/main.yml             |   6 ++
 playbooks/roles/libvirt_user/README.md             |   4 +-
 playbooks/roles/pkg/README.md                      |   2 +-
 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                            |   4 +-
 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/build.Makefile                             |   2 +-
 scripts/devconfig.Makefile                         |   8 +-
 scripts/dynamic-pci-kconfig.Makefile               |   3 +-
 scripts/firstconfig.Makefile                       |   5 +-
 scripts/gen-hosts.Makefile                         |   1 -
 scripts/guestfs.Makefile                           |  19 ++--
 scripts/install-menuconfig-deps.Makefile           |   3 +-
 scripts/iscsi.Makefile                             |   1 -
 scripts/journal-server.Makefile                    |  23 +++--
 scripts/kotd.Makefile                              |  16 ++--
 scripts/krb5.Makefile                              |   2 -
 scripts/ktls.Makefile                              |   1 -
 scripts/lib.sh                                     |   2 +-
 scripts/nfsd.Makefile                              |   1 -
 scripts/provision.Makefile                         |   5 +-
 scripts/rdma.Makefile                              |   2 -
 scripts/smbd.Makefile                              |   1 -
 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                           |  60 +++++++-----
 workflows/ltp/Makefile                             |   8 +-
 workflows/mmtests/Makefile                         |  12 +--
 workflows/nfstest/Makefile                         |   8 +-
 workflows/pynfs/Makefile                           |  12 +--
 workflows/selftests/Makefile                       |  11 ++-
 workflows/steady_state/Makefile                    |   8 +-
 workflows/sysbench/Makefile                        |  12 +--
 115 files changed, 601 insertions(+), 323 deletions(-)

---
base-commit: df5f66ca52a8dd0794c4c0ea72c1068643a18279
change-id: 20250430-ansible_cfg_inventory-7955944ce8ff

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>
#1 lore raw

PATCH v5 1/12 playbooks: fix playbook name for all hosts plays

From: Daniel Gomez <[email protected]>

Fix name rule by naming all the playbooks that run in all hosts.

https://ansible.readthedocs.io/projects/lint/rules/name/

---
 playbooks/blktests.yml              | 3 ++-
 playbooks/bootlinux.yml             | 3 ++-
 playbooks/common.yml                | 3 ++-
 playbooks/create_data_partition.yml | 3 ++-
 playbooks/cxl.yml                   | 3 ++-
 playbooks/devconfig.yml             | 3 ++-
 playbooks/fstests.yml               | 3 ++-
 playbooks/gitr.yml                  | 3 ++-
 playbooks/iscsi.yml                 | 3 ++-
 playbooks/kdc.yml                   | 3 ++-
 playbooks/krb5.yml                  | 3 ++-
 playbooks/ktls.yml                  | 3 ++-
 playbooks/ltp.yml                   | 3 ++-
 playbooks/nfsd.yml                  | 3 ++-
 playbooks/nfstest.yml               | 3 ++-
 playbooks/pkg.yml                   | 3 ++-
 playbooks/pynfs.yml                 | 3 ++-
 playbooks/reboot-limit.yml          | 3 ++-
 playbooks/rxe.yml                   | 3 ++-
 playbooks/selftests.yml             | 3 ++-
 playbooks/siw.yml                   | 3 ++-
 playbooks/smbd.yml                  | 3 ++-
 playbooks/sysbench.yml              | 3 ++-
 playbooks/terraform.yml             | 1 +
 playbooks/update_etc_hosts.yml      | 3 ++-
 25 files changed, 49 insertions(+), 24 deletions(-)
playbooks/blktests.yml +2 -1
index 99732af..db58d43 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run the block layer testing workflow
+  hosts: all
   roles:
     - role: blktests
playbooks/bootlinux.yml +2 -1
index 418bbed..676469d 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: bootlinux
+  hosts: all
   roles:
     - role: bootlinux
playbooks/common.yml +2 -1
index 48485e3..d49e7d0 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Common tasks
+  hosts: all
   roles:
     - role: common
playbooks/create_data_partition.yml +2 -1
index fe7890b..fa92567 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Create Directory Data Path (e.g. /data partition)
+  hosts: all
   roles:
     - role: create_data_partition
playbooks/cxl.yml +2 -1
index 8763859..65277d4 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: cxl
+  hosts: all
   roles:
     - role: cxl
playbooks/devconfig.yml +2 -1
index 871651d..b4a7393 100644
@@ -1,5 +1,6 @@
 ---
-- hosts: all
+- name: Configure developer environment on target systems
+  hosts: all
   gather_facts: no
   roles:
     - role: devconfig
playbooks/fstests.yml +2 -1
index de8cb25..191c807 100644
@@ -3,6 +3,7 @@
   roles:
     - role: fstests_prep_localhost
 
-- hosts: all
+- name: Configure and run the filesystem testing suite workflow
+  hosts: all
   roles:
     - role: fstests
playbooks/gitr.yml +2 -1
index 4c3e3ba..c210cc3 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Git regresion filesystem test workflow
+  hosts: all
   roles:
     - role: gitr
playbooks/iscsi.yml +2 -1
index cea4000..fb1e7a2 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Provision and manage iSCSI targets and LUNs for shared block storage
+  hosts: all
   roles:
     - role: iscsi
playbooks/kdc.yml +2 -1
index 66709db..cab5265 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Setup MIT Kerberos V5 KDC with realm and admin settings
+  hosts: all
   roles:
     - role: kdc
playbooks/krb5.yml +2 -1
index 52ca3ef..a79475f 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Setup MIT Kerberos V5 KDC and configure NFS clients for Kerberos authentication
+  hosts: all
   roles:
     - role: krb5
playbooks/ktls.yml +2 -1
index 8b7044c..b07a161 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Provision self-signed TLS certs and enable tlshd for kernel TLS testing (ktls)
+  hosts: all
   roles:
     - role: ktls
playbooks/ltp.yml +2 -1
index 5921cef..d1e8835 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run the Linux Test Project (LTP) suite workflow
+  hosts: all
   roles:
     - role: ltp
playbooks/nfsd.yml +2 -1
index 6c77358..b129300 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Set up and start the NFS server with configurable exports
+  hosts: all
   roles:
     - role: nfsd
playbooks/nfstest.yml +2 -1
index d414091..5df62ff 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run the nfstest workflow for NFS testing
+  hosts: all
   roles:
     - role: nfstest
playbooks/pkg.yml +2 -1
index f9d3e62..d6718a1 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Package name wrapper
+  hosts: all
   roles:
     - role: pkg
playbooks/pynfs.yml +2 -1
index ad5b3e2..1ce6cb7 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run pynfs testing workflow
+  hosts: all
   roles:
     - role: pynfs
playbooks/reboot-limit.yml +2 -1
index 3793623..7cbaea0 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run the reboot-limit workflow
+  hosts: all
   roles:
     - role: reboot-limit
playbooks/rxe.yml +2 -1
index dc51c03..a5d058f 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Set up software-emulated RoCE RDMA over Ethernet (rxe) via udev
+  hosts: all
   roles:
     - role: rxe
playbooks/selftests.yml +2 -1
index 6f7d777..89bc824 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run Linux kernel selftests (kselftests)
+  hosts: all
   roles:
     - role: selftests
playbooks/siw.yml +2 -1
index 5258a5a..e6b9d61 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Set up software-emulated iWARP RDMA over TCP/IP (siw) via udev
+  hosts: all
   roles:
     - role: siw
playbooks/smbd.yml +2 -1
index 47cd022..ec5176a 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Set up Samba server with shared volume and system integration
+  hosts: all
   roles:
     - role: smbd
playbooks/sysbench.yml +2 -1
index 6102635..37d7824 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: all
+- name: Configure and run the sysbench workflow
+  hosts: baseline:dev
   roles:
     - role: sysbench
playbooks/terraform.yml +1 -0
index 15872a6..9b5baed 100644
@@ -1,5 +1,6 @@
 ---
 - name: Provision target nodes with terraform
+  hosts: all
   gather_facts: false
   hosts: all
   roles:
playbooks/update_etc_hosts.yml +2 -1
index a0c2174..269f23c 100644
@@ -1,5 +1,6 @@
 ---
-- hosts: all
+- name: Update target /etc/hosts with all targets and disable cloud-init
+  hosts: all
   gather_facts: no
   roles:
     - role: update_etc_hosts
Signature · 1 line
2.50.1
#2 lore raw

PATCH v5 2/12 playbooks: fix playbook name for localhost plays

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Fix name rule by naming all the playbooks that run in localhost.

https://ansible.readthedocs.io/projects/lint/rules/name/

---
 playbooks/build_qemu.yml                     | 3 ++-
 playbooks/fstests.yml                        | 3 ++-
 playbooks/gen-pci-kconfig.yml                | 3 ++-
 playbooks/gen_hosts.yml                      | 3 ++-
 playbooks/gen_nodes.yml                      | 3 ++-
 playbooks/gen_tfvars.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/kdevops_archive.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/postfix_relay_host.yml             | 3 ++-
 playbooks/update_ssh_config_guestfs.yml      | 3 ++-
 playbooks/update_ssh_config_vagrant.yml      | 3 ++-
 20 files changed, 40 insertions(+), 20 deletions(-)
playbooks/build_qemu.yml +2 -1
index d094c25..861647e 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Build and install QEMU
+  hosts: localhost
   roles:
     - role: build_qemu
playbooks/fstests.yml +2 -1
index 191c807..35a2122 100644
@@ -1,5 +1,6 @@
 ---
-- hosts: localhost
+- name: Enable fstests JUnit XML result processing
+  hosts: localhost
   roles:
     - role: fstests_prep_localhost
 
playbooks/gen-pci-kconfig.yml +2 -1
index a20aba7..7a4ce89 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Generate dynamic PCI-E passthrough Kconfig files for libvirt guests
+  hosts: localhost
   roles:
     - role: gen_pci_kconfig
playbooks/gen_hosts.yml +2 -1
index 942b4f2..c6b3b73 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Generate Ansible inventory for guests (hosts)
+  hosts: localhost
   roles:
     - role: gen_hosts
playbooks/gen_nodes.yml +2 -1
index c298b34..39a259f 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Generate guests node configuration (libvirt domain XML)
+  hosts: localhost
   roles:
     - role: gen_nodes
playbooks/gen_tfvars.yml +2 -1
index 5ff85af..9d75c86 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Generate Terraform variables file (terraform/terraform.tfvars)
+  hosts: localhost
   roles:
     - role: gen_tfvars
playbooks/hypervisor-tuning.yml +2 -1
index 29f735d..c295b87 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Apply hypervisor tuning settings (KSM and Zswap)
+  hosts: localhost
   roles:
     - role: hypervisor-tuning
playbooks/install-menuconfig-deps.yml +2 -1
index 845b287..be1c643 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Install dependencies for Kconfig menuconfig
+  hosts: localhost
   roles:
     - role: install-menuconfig-deps
playbooks/install_systemd_journal_remote.yml +2 -1
index 46014d2..5cc0870 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Install and configure systemd-journal-remote for remote journal collection
+  hosts: localhost
   roles:
     - role: install_systemd_journal_remote
playbooks/install_systemd_timesyncd.yml +2 -1
index ed1a31e..7590645 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Install and configure systemd-timesyncd for NTP time sync
+  hosts: localhost
   roles:
     - role: install_systemd_timesyncd
playbooks/install_terraform.yml +2 -1
index 1426378..5a5fa72 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Install Terraform
+  hosts: localhost
   roles:
     - role: install_terraform
playbooks/install_vagrant_boxes.yml +2 -1
index 8cffb36..01c0728 100644
@@ -1,5 +1,6 @@
 ---
-- hosts: localhost
+- name: install_vagrant_boxes
+  hosts: localhost
   tasks:
     - include_role:
         name: install_vagrant_boxes
playbooks/kdevops_archive.yml +2 -1
index a61f794..cbf8dea 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Archive and push kdevops CI test results
+  hosts: localhost
   roles:
     - role: kdevops_archive
playbooks/libvirt_pcie_passthrough.yml +2 -1
index 39d5c8e..f128bdd 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Configure PCIe passthrough for libvirt VMs
+  hosts: localhost
   roles:
     - role: libvirt_pcie_passthrough
playbooks/libvirt_storage_pool_create.yml +2 -1
index f127f5e..8f0d7b0 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Create and configure a Libvirt storage pool
+  hosts: localhost
   roles:
     - role: libvirt_storage_pool_create
playbooks/libvirt_user.yml +2 -1
index 6e3889c..7923b05 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Allow user to run libvirt guests
+  hosts: localhost
   roles:
     - role: libvirt_user
playbooks/linux-mirror.yml +2 -1
index 0808ebc..2af0f89 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Install Git mirrors using systemd.timer
+  hosts: localhost
   roles:
     - role: linux-mirror
playbooks/postfix_relay_host.yml +2 -1
index b04079b..c7b3427 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Configure and enable Postfix with a custom relay host
+  hosts: localhost
   roles:
     - role: postfix_relay_host
playbooks/update_ssh_config_guestfs.yml +2 -1
index 346b902..56faed2 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: Update OpenSSH client configuration file (libguestfs)
+  hosts: localhost
   roles:
     - role: update_ssh_config_guestfs
playbooks/update_ssh_config_vagrant.yml +2 -1
index c8d0e99..7a2162e 100644
@@ -1,4 +1,5 @@
 ---
-- hosts: localhost
+- name: update_ssh_config_vagrant
+  hosts: localhost
   roles:
     - role: update_ssh_config_vagrant
Signature · 1 line
2.50.1
#3 lore raw

PATCH v5 3/12 Makefile: use long form of limit argument for clarity

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Replace the short -l argument option with the more explicit --limit in the Makefile for ansible-playbook runs. This improves readability and makes the purpose of the flag clearer.

Remove the quotes when using the long form to properly expand LIMIT_HOSTS with the long form.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index c6a5c32..baa4a5c 100644
@@ -62,7 +62,7 @@ include scripts/ansible.Makefile
 
 LIMIT_HOSTS :=
 ifneq (,$(HOSTS))
-LIMIT_HOSTS := '-l $(subst ${space},$(comma),$(HOSTS))'
+LIMIT_HOSTS := --limit $(subst ${space},$(comma),$(HOSTS))
 endif
 
 export LIMIT_TESTS :=
Signature · 1 line
2.50.1
#4 lore raw

PATCH v5 4/12 Makefile: print target when debug

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

When debugging with V=1, print also the Makefile target before the command.

This allows to specify the target as well as keep verbosity of the command being executed. The only limitation is that commands are printed in one line.

Example:
make V=1
==> [ansible.cfg]
+ ansible-playbook playbooks/ansible_cfg.yml --extra-vars=@./.extra_vars_auto.yaml [WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point.
PLAY 1: ANSIBLE CONFIGURATION ROLE
task 1. [started TASK: Gathering Facts on localhost]
task 2. [started TASK: ansible_cfg : Import optional extra_args file on localhost] task 3. [started TASK: ansible_cfg : Generate kdevops ansible.cfg on localhost]

==> [inventory]
+ ansible-playbook playbooks/gen_hosts.yml --extra-vars=@./extra_vars.yaml {...}

Before:
make V=1
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point.
PLAY 1: ANSIBLE CONFIGURATION ROLE
task 1. [started TASK: Gathering Facts on localhost]
task 2. [started TASK: ansible_cfg : Import optional extra_args file on localhost] task 3. [started TASK: ansible_cfg : Generate kdevops ansible.cfg on localhost]

ansible-playbook  \
        playbooks/gen_hosts.yml \
        --extra-vars=@./extra_vars.yaml

[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point. PLAY 1: GEN_HOSTS
task 1. [started TASK: Gathering Facts on localhost]
{...}

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -1
index baa4a5c..5369428 100644
@@ -38,8 +38,12 @@ KDEVOPS_DEPCHECK = .kdevops.depcheck
 
 PHONY += kconfig-help-menu
 
+define print_target
+	echo "==> [$1]"
+endef
+
 ifeq ($(V),1)
-export Q=
+export Q=@$(call print_target,$@) && set -x &&
 export NQ=true
 else
 export Q=@
Signature · 1 line
2.50.1
#5 lore raw

PATCH v5 5/12 .github/workflows/fstests.yml: enable make verbosity

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

This prints the commands as well as the Makefile target being run.

---
 .github/workflows/fstests.yml | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
.github/workflows/fstests.yml +8 -8
index 5988a86..e13978c 100644
@@ -45,23 +45,23 @@ jobs:
 
       - name: Run kdevops make
         run: |
-          make -j$(nproc)
+          make V=1 -j$(nproc)
 
       - name: Run kdevops make bringup
         run: |
-          make bringup
+          make V=1 bringup
 
       - name: Build linux and boot test nodes on test kernel
         run: |
-          make linux
+          make V=1 linux
 
       - name: Build fstests
         run: |
-          make fstests
+          make V=1 fstests
 
       - name: Run just one fstest to verify we tests and test collection works
         run: |
-          make fstests-baseline TESTS=generic/003
+          make V=1 fstests-baseline TESTS=generic/003
           echo "ok" > ci.result
           find workflows/fstests/results/last-run -name xunit_results.txt -type f -exec cat {} \; > ci.commit_extra || true
           if ! grep -E "failures, [1-9]|errors, [1-9]" ci.commit_extra; then
@@ -71,7 +71,7 @@ jobs:
       - name: Get systemd journal files
         if: always() # This ensures the step runs even if previous steps failed
         run: |
-          make journal-dump
+          make V=1 journal-dump
 
       - name: Start SSH Agent
         if: always()  # Ensure this step runs even if previous steps failed
@@ -82,7 +82,7 @@ jobs:
       - name: Build our kdevops archive results
         if: always() # This ensures the step runs even if previous steps failed
         run: |
-          make ci-archive
+          make V=1 ci-archive
 
       - name: Upload our kdevops results archive
         if: always() # This ensures the step runs even if previous steps failed
@@ -95,4 +95,4 @@ jobs:
       - name: Run kdevops make destroy
         if: always()  # This ensures the step runs even if previous steps failed
         run: |
-          make destroy
+          make V=1 destroy
Signature · 1 line
2.50.1
#6 lore raw

PATCH v5 6/12 ansible_cfg: add inventory support

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

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.

---
 kconfigs/Kconfig.ansible_cfg                         | 18 ++++++++++++++++++
 kconfigs/Kconfig.ansible_provisioning                |  8 +-------
 playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 |  1 +
 scripts/lib.sh                                       |  2 +-
 4 files changed, 21 insertions(+), 8 deletions(-)
kconfigs/Kconfig.ansible_cfg +18 -0
index a8b6cef..735160c 100644
@@ -224,6 +224,24 @@ config ANSIBLE_CFG_TASK_DEBUGGER
 
 	  https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_debugger.html#id10
 
+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 = <value>
+
+	  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
kconfigs/Kconfig.ansible_provisioning +1 -7
index 63f0430..194b0b3 100644
@@ -13,7 +13,7 @@ config KDEVOPS_ANSIBLE_PROVISION_ENABLE
 	help
 	  If enabled we will provision the target hosts with ansible as a last
 	  last step after bringup. This playbook used to provision is
-	  configurable refer to CONFIG_KDEVOPS_ANSIBLE_INVENTORY_FILE.
+	  configurable refer to CONFIG_ANSIBLE_CFG_INVENTORY.
 
 if KDEVOPS_ANSIBLE_PROVISION_ENABLE
 
@@ -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
playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 +1 -0
index f71033b..e968bb3 100644
@@ -11,6 +11,7 @@ show_task_path_on_failure = {{ ansible_cfg_callback_plugin_show_task_path_on_fai
 interpreter_python = {{ ansible_cfg_interpreter_python_string }}
 forks = {{ ansible_cfg_forks }}
 enable_task_debugger = {{ ansible_cfg_task_debugger }}
+inventory = {{ ansible_cfg_inventory }}
 {% if ansible_facts['distribution'] == 'openSUSE' %}
 [connection]
 retries = {{ ansible_cfg_reconnection_retries }}
scripts/lib.sh +1 -1
index 936e3ce..0419fd3 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: copyleft-next-0.3.1
 
 PLAYBOOKDIR=$CONFIG_KDEVOPS_PLAYBOOK_DIR
-INVENTORY=$CONFIG_KDEVOPS_ANSIBLE_INVENTORY_FILE
+INVENTORY=$CONFIG_ANSIBLE_CFG_INVENTORY
 export KDEVOPSHOSTSPREFIX=$CONFIG_KDEVOPS_HOSTS_PREFIX
 
 MANUAL_KILL_NOTICE_FILE="${TOPDIR}/.running_kill_pids.sh"
Signature · 1 line
2.50.1
#7 lore raw

PATCH v5 7/12 gen_hosts: add service group to inventory templates

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

---
 playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++
 playbooks/roles/gen_hosts/templates/gitr.j2    |  9 +++++++++
 playbooks/roles/gen_hosts/templates/hosts.j2   |  9 +++++++++
 playbooks/roles/gen_hosts/templates/nfstest.j2 |  9 +++++++++
 playbooks/roles/gen_hosts/templates/pynfs.j2   |  7 +++++++
 5 files changed, 49 insertions(+)
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
index abcdafd..a489c12 100644
@@ -69,3 +69,18 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [krb5:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+{% if kdevops_smbd_enable %}
+{{ kdevops_hosts_prefix }}-smbd
+{% endif %}
+{% if kdevops_krb5_enable %}
+{{ kdevops_hosts_prefix }}-kdc
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/gitr.j2 +9 -0
index b8f393d..41aee2b 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/hosts.j2 +9 -0
index 5032f59..639f5a4 100644
@@ -44,4 +44,13 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
playbooks/roles/gen_hosts/templates/nfstest.j2 +9 -0
index 6a0d6cd..fb47471 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/pynfs.j2 +7 -0
index c018c54..cac6fc6 100644
@@ -22,3 +22,10 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {{ kdevops_hosts_prefix }}-nfsd
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{{ kdevops_hosts_prefix }}-nfsd
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
Signature · 1 line
2.50.1
Reviewed-by on v5 7/12
#8 lore raw

Re: [PATCH v5 07/12] gen_hosts: add service group to inventory templates

Quoted 13 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

Quoted 4 lines

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

No newline needed

Quoted 2 lines

Luis

#9 lore raw

Re: [PATCH v5 07/12] gen_hosts: add service group to inventory templates

Quoted 14 lines · Luis Chamberlain
Quoted 13 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

Quoted 6 lines
Quoted 4 lines

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

No newline needed

Making sure I'm not adding this line this time...

Quoted 4 lines
Quoted 2 lines

Thanks!

Quoted 2 lines

Luis

#10 lore raw

Re: [PATCH v5 07/12] gen_hosts: add service group to inventory templates

In reply to Daniel Gomez
Quoted 108 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

---
 playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++
 playbooks/roles/gen_hosts/templates/gitr.j2    |  9 +++++++++
 playbooks/roles/gen_hosts/templates/hosts.j2   |  9 +++++++++
 playbooks/roles/gen_hosts/templates/nfstest.j2 |  9 +++++++++
 playbooks/roles/gen_hosts/templates/pynfs.j2   |  7 +++++++
 5 files changed, 49 insertions(+)
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
index abcdafd..a489c12 100644
@@ -69,3 +69,18 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [krb5:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+{% if kdevops_smbd_enable %}
+{{ kdevops_hosts_prefix }}-smbd
+{% endif %}
+{% if kdevops_krb5_enable %}
+{{ kdevops_hosts_prefix }}-kdc
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/gitr.j2 +9 -0
index b8f393d..41aee2b 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/hosts.j2 +9 -0
index 5032f59..639f5a4 100644
@@ -44,4 +44,13 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
playbooks/roles/gen_hosts/templates/nfstest.j2 +9 -0
index 6a0d6cd..fb47471 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/pynfs.j2 +0 -0
index c018c54..cac6fc6 100644

playbooks/roles/gen_hosts/templates/pynfs.j2 ansible_python_interpreter = "{{ kdevops_python_interpreter }}" · line 31

Quoted 10 lines
playbooks/roles/gen_hosts/templates/pynfs.j2 +7 -0
@@ -22,3 +22,10 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {{ kdevops_hosts_prefix }}-nfsd
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{{ kdevops_hosts_prefix }}-nfsd
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"

The issue with the pynfs workflow is that the "nfsd" host is also where the tests run. I think what you're doing is adding that host into both the test-runners group and the new "service" group, which is probably OK.

Would it be better if the pynfs workflow created a separate test runner and nfsd host? Or even two test runners, one for NFSv4.0 and one for NFSv4.1 ? That way the pynfs workflow would operate like the others.

Just a random thought, not an objection.

Signature · 1 line
Chuck Lever
#11 lore raw

Re: [PATCH v5 07/12] gen_hosts: add service group to inventory templates

Quoted 116 lines · Chuck Lever
Quoted 115 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

---
 playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++
 playbooks/roles/gen_hosts/templates/gitr.j2    |  9 +++++++++
 playbooks/roles/gen_hosts/templates/hosts.j2   |  9 +++++++++
 playbooks/roles/gen_hosts/templates/nfstest.j2 |  9 +++++++++
 playbooks/roles/gen_hosts/templates/pynfs.j2   |  7 +++++++
 5 files changed, 49 insertions(+)
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
index abcdafd..a489c12 100644
@@ -69,3 +69,18 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [krb5:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+{% if kdevops_smbd_enable %}
+{{ kdevops_hosts_prefix }}-smbd
+{% endif %}
+{% if kdevops_krb5_enable %}
+{{ kdevops_hosts_prefix }}-kdc
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/gitr.j2 +9 -0
index b8f393d..41aee2b 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/hosts.j2 +9 -0
index 5032f59..639f5a4 100644
@@ -44,4 +44,13 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
playbooks/roles/gen_hosts/templates/nfstest.j2 +9 -0
index 6a0d6cd..fb47471 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/pynfs.j2 +5 -0
index c018c54..cac6fc6 100644
@@ -22,3 +22,10 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {{ kdevops_hosts_prefix }}-nfsd
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{{ kdevops_hosts_prefix }}-nfsd
Quoted 8 lines

playbooks/roles/gen_hosts/templates/pynfs.j2 ansible_python_interpreter = "{{ kdevops_python_interpreter }}" · line 31

Quoted 3 lines
playbooks/roles/gen_hosts/templates/pynfs.j2 +2 -0
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"

The issue with the pynfs workflow is that the "nfsd" host is also where the tests run. I think what you're doing is adding that host into both the test-runners group and the new "service" group, which is probably OK.

That is correct.

Quoted 4 lines

Would it be better if the pynfs workflow created a separate test runner and nfsd host? Or even two test runners, one for NFSv4.0 and one for NFSv4.1 ? That way the pynfs workflow would operate like the others.

You mean like in fstests, right?
FSTESTS_NFS_SECTION_V42
FSTESTS_NFS_SECTION_V41
FSTESTS_NFS_SECTION_V40

I agree pynfs is not consistent with the rest of the workflows. But I'm not familiar with pynfs to agree if your suggestion make sense. Can you clarify if your suggestion means having 2 kdevops profiles (i.e. 2 separate guests/vms) with NFSv4.0 and NFS4.1 with both the option to run CONFIG_PYNFS_PNFS_BLOCK or not. How is it done now? Does the test switch between NFS versions or uses 2 different NFS mount points to run the pynfs suite tests on them? Would nfsd guest support both new vms?

Quoted 2 lines

Just a random thought, not an objection.

Would you agree to do this separately?

#12 lore raw

Re: [PATCH v5 07/12] gen_hosts: add service group to inventory templates

Quoted 131 lines · Daniel Gomez
Quoted 116 lines · Chuck Lever
Quoted 115 lines · Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a new 'service' group in all inventory templates that includes service hosts (iscsi, nfsd, smbd, kdc). This provides a convenient way to target all service hosts collectively for operations like guestfs bringup and SSH configuration.

The service group includes:
- iscsi hosts (when kdevops_enable_iscsi is enabled)
- nfsd hosts (when kdevops_nfsd_enable is enabled)
- smbd hosts (when kdevops_smbd_enable is enabled)
- kdc hosts (when kdevops_krb5_enable is enabled)

This addresses issues where operations limited to 'baseline:dev' would miss required service hosts, causing workflow failures.

Generated-by: Claude AI

---
 playbooks/roles/gen_hosts/templates/fstests.j2 | 15 +++++++++++++++
 playbooks/roles/gen_hosts/templates/gitr.j2    |  9 +++++++++
 playbooks/roles/gen_hosts/templates/hosts.j2   |  9 +++++++++
 playbooks/roles/gen_hosts/templates/nfstest.j2 |  9 +++++++++
 playbooks/roles/gen_hosts/templates/pynfs.j2   |  7 +++++++
 5 files changed, 49 insertions(+)
playbooks/roles/gen_hosts/templates/fstests.j2 +15 -0
index abcdafd..a489c12 100644
@@ -69,3 +69,18 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [krb5:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+{% if kdevops_smbd_enable %}
+{{ kdevops_hosts_prefix }}-smbd
+{% endif %}
+{% if kdevops_krb5_enable %}
+{{ kdevops_hosts_prefix }}-kdc
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/gitr.j2 +9 -0
index b8f393d..41aee2b 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/hosts.j2 +9 -0
index 5032f59..639f5a4 100644
@@ -44,4 +44,13 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
playbooks/roles/gen_hosts/templates/nfstest.j2 +9 -0
index 6a0d6cd..fb47471 100644
@@ -37,3 +37,12 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {% endif %}
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{% if kdevops_nfsd_enable %}
+{{ kdevops_hosts_prefix }}-nfsd
+{% endif %}
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/pynfs.j2 +5 -0
index c018c54..cac6fc6 100644
@@ -22,3 +22,10 @@ ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
 {{ kdevops_hosts_prefix }}-nfsd
 [nfsd:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
+[service]
+{% if kdevops_enable_iscsi %}
+{{ kdevops_hosts_prefix }}-iscsi
+{% endif %}
+{{ kdevops_hosts_prefix }}-nfsd
Quoted 8 lines

playbooks/roles/gen_hosts/templates/pynfs.j2 ansible_python_interpreter = "{{ kdevops_python_interpreter }}" · line 31

Quoted 3 lines
playbooks/roles/gen_hosts/templates/pynfs.j2 +2 -0
+[service:vars]
+ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"

The issue with the pynfs workflow is that the "nfsd" host is also where the tests run. I think what you're doing is adding that host into both the test-runners group and the new "service" group, which is probably OK.

That is correct.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Would it be better if the pynfs workflow created a separate test runner and nfsd host? Or even two test runners, one for NFSv4.0 and one for NFSv4.1 ? That way the pynfs workflow would operate like the others.

You mean like in fstests, right?
FSTESTS_NFS_SECTION_V42
FSTESTS_NFS_SECTION_V41
FSTESTS_NFS_SECTION_V40

Yes.

Quoted 7 lines

I agree pynfs is not consistent with the rest of the workflows. But I'm not familiar with pynfs to agree if your suggestion make sense. Can you clarify if your suggestion means having 2 kdevops profiles (i.e. 2 separate guests/vms) with NFSv4.0 and NFS4.1 with both the option to run CONFIG_PYNFS_PNFS_BLOCK or not. How is it done now? Does the test switch between NFS versions or uses 2 different NFS mount points to run the pynfs suite tests on them? Would nfsd guest support both new vms?

The way the NFS-related workflows do it is the workflow creates one NFS export for each test runner (section). What pynfs doesn't do is create separate clients for each NFS version (section).

So here, one test runner would run the NFSv4.0 tests, and mount its own NFS export. A second test runner would run the NFSv4.1 tests, and mount its own NFS export.

The pNFS block switch enables a few extra tests in the NFSv4.1 script, and it requires the NFS server to be set up with iSCSI, etc. Yes, we could create a separate client test runner for that, I need to think about it.

Quoted 3 lines
Quoted 1 line

Just a random thought, not an objection.

Would you agree to do this separately?

Yes, absolutely.

Signature · 1 line
Chuck Lever
#13 lore raw

PATCH v5 8/12 gen_hosts: templates: include localhost in the all group

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

This change redefines the Ansible inventory 'all' pattern to include the controller host (localhost), which was previously excluded.

Until now, the generated inventory (typically at $TOPDIR_PATH/hosts) only listed the target nodes, omitting the controller. As a result, playbooks that needed to operate on the controller node had to explicitly define localhost as a target with a specific connection.

By including localhost in the inventory, we simplify Ansible usage (in the following commits) by removing the need to pass localhost-specific overrides on the command line. Kdevops can now let Ansible consistently operate on all relevant nodes defined in the inventory.

Playbooks are also updated to limit the hosts pattern to baseline and dev groups instead of using all, ensuring that tasks are correctly scoped as expected by kdevops.

Finally, update ueh_hosts in the update_etc_hosts role to include only the hosts targeted in the current play, rather than all hosts in the inventory. This avoids the error below when the inventory includes localhost in the all group:

"The task includes an option with an undefined variable. The error
was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_all_ipv4_addresses'. 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_all_ipv4_addresses'"

[1]
https://docs.ansible.com/ansible/latest/inventory_guide/
intro_patterns.html#common-patterns

---
 playbooks/blktests.yml                           | 2 +-
 playbooks/common.yml                             | 2 +-
 playbooks/create_data_partition.yml              | 2 +-
 playbooks/cxl.yml                                | 2 +-
 playbooks/devconfig.yml                          | 2 +-
 playbooks/fstests.yml                            | 2 +-
 playbooks/gitr.yml                               | 2 +-
 playbooks/iscsi.yml                              | 2 +-
 playbooks/kdc.yml                                | 2 +-
 playbooks/krb5.yml                               | 2 +-
 playbooks/ktls.yml                               | 2 +-
 playbooks/ltp.yml                                | 2 +-
 playbooks/nfsd.yml                               | 2 +-
 playbooks/nfstest.yml                            | 2 +-
 playbooks/pkg.yml                                | 2 +-
 playbooks/pynfs.yml                              | 2 +-
 playbooks/reboot-limit.yml                       | 2 +-
 playbooks/roles/common/README.md                 | 2 +-
 playbooks/roles/devconfig/README.md              | 2 +-
 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/pkg/README.md                    | 2 +-
 playbooks/roles/update_etc_hosts/tasks/main.yml  | 2 +-
 playbooks/rxe.yml                                | 2 +-
 playbooks/selftests.yml                          | 2 +-
 playbooks/siw.yml                                | 2 +-
 playbooks/smbd.yml                               | 2 +-
 playbooks/terraform.yml                          | 5 ++---
 playbooks/update_etc_hosts.yml                   | 2 +-
 scripts/devconfig.Makefile                       | 4 ++--
 scripts/guestfs.Makefile                         | 2 +-
 workflows/linux/Makefile                         | 2 +-
 40 files changed, 43 insertions(+), 33 deletions(-)
playbooks/blktests.yml +1 -1
index db58d43..9285e8e 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run the block layer testing workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: blktests
playbooks/common.yml +1 -1
index d49e7d0..45b106d 100644
@@ -1,5 +1,5 @@
 ---
 - name: Common tasks
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: common
playbooks/create_data_partition.yml +1 -1
index fa92567..b180cf4 100644
@@ -1,5 +1,5 @@
 ---
 - name: Create Directory Data Path (e.g. /data partition)
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: create_data_partition
playbooks/cxl.yml +1 -1
index 65277d4..8880ee7 100644
@@ -1,5 +1,5 @@
 ---
 - name: cxl
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: cxl
playbooks/devconfig.yml +1 -1
index b4a7393..b0b9d42 100644
@@ -1,6 +1,6 @@
 ---
 - name: Configure developer environment on target systems
-  hosts: all
+  hosts: baseline:dev
   gather_facts: no
   roles:
     - role: devconfig
playbooks/fstests.yml +1 -1
index 35a2122..193ecdc 100644
@@ -5,6 +5,6 @@
     - role: fstests_prep_localhost
 
 - name: Configure and run the filesystem testing suite workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: fstests
playbooks/gitr.yml +1 -1
index c210cc3..a7464e5 100644
@@ -1,5 +1,5 @@
 ---
 - name: Git regresion filesystem test workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: gitr
playbooks/iscsi.yml +1 -1
index fb1e7a2..5bcfb73 100644
@@ -1,5 +1,5 @@
 ---
 - name: Provision and manage iSCSI targets and LUNs for shared block storage
-  hosts: all
+  hosts: iscsi
   roles:
     - role: iscsi
playbooks/kdc.yml +1 -1
index cab5265..35b576c 100644
@@ -1,5 +1,5 @@
 ---
 - name: Setup MIT Kerberos V5 KDC with realm and admin settings
-  hosts: all
+  hosts: kdc
   roles:
     - role: kdc
playbooks/krb5.yml +1 -1
index a79475f..96d41a5 100644
@@ -1,5 +1,5 @@
 ---
 - name: Setup MIT Kerberos V5 KDC and configure NFS clients for Kerberos authentication
-  hosts: all
+  hosts: krb5
   roles:
     - role: krb5
playbooks/ktls.yml +1 -1
index b07a161..8c3d42b 100644
@@ -1,5 +1,5 @@
 ---
 - name: Provision self-signed TLS certs and enable tlshd for kernel TLS testing (ktls)
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: ktls
playbooks/ltp.yml +1 -1
index d1e8835..7c00488 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run the Linux Test Project (LTP) suite workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: ltp
playbooks/nfsd.yml +1 -1
index b129300..feed988 100644
@@ -1,5 +1,5 @@
 ---
 - name: Set up and start the NFS server with configurable exports
-  hosts: all
+  hosts: nfsd
   roles:
     - role: nfsd
playbooks/nfstest.yml +1 -1
index 5df62ff..e77273b 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run the nfstest workflow for NFS testing
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: nfstest
playbooks/pkg.yml +1 -1
index d6718a1..4d8aa5f 100644
@@ -1,5 +1,5 @@
 ---
 - name: Package name wrapper
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: pkg
playbooks/pynfs.yml +1 -1
index 1ce6cb7..421ee77 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run pynfs testing workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: pynfs
playbooks/reboot-limit.yml +1 -1
index 7cbaea0..96b8cb4 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run the reboot-limit workflow
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: reboot-limit
playbooks/roles/common/README.md +1 -1
index 2b0084c..c5b0bbd 100644
@@ -27,7 +27,7 @@ Below is an example playbook task:
 
 ```
 ---
-- hosts: all
+- hosts: baseline:dev
   roles:
     - role: common
 ```
playbooks/roles/devconfig/README.md +1 -1
index fa35539..10e4b21 100644
@@ -58,7 +58,7 @@ Below is an example playbook task:
 
 ```
 ---
-- hosts: all
+- hosts: baseline:dev
   roles:
     - role: devconfig
 ```
playbooks/roles/gen_hosts/templates/blktests.j2 +1 -0
index 1c2f8f7..5bf50ac 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for test_type in blktests_enabled_test_types %}
 {{ kdevops_host_prefix }}-{{ test_type }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/cxl.j2 +1 -0
index 1b3034e..64bec45 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {{ kdevops_hosts_prefix }}
 {% if kdevops_baseline_and_dev == True %}
 {{ kdevops_hosts_prefix }}-dev
playbooks/roles/gen_hosts/templates/fstests.j2 +1 -0
index a489c12..ac086c6 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for s in fstests_enabled_test_types %}
 {{ kdevops_host_prefix }}-{{ s }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/gitr.j2 +1 -0
index 41aee2b..7f9094d 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for s in gitr_enabled_hosts %}
 {{ kdevops_host_prefix }}-{{ s }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/hosts.j2 +2 -0
index 639f5a4..ca6adcf 100644
@@ -7,9 +7,11 @@ its own jinja2 template file and define its own ansible task for its generation.
 #}
 {% if kdevops_workflows_dedicated_workflow %}
 [all]
+localhost ansible_connection=local
 write-your-own-template-for-your-workflow-and-task
 {% else %}
 [all]
+localhost ansible_connection=local
 {{ kdevops_hosts_prefix }}
 {% if kdevops_baseline_and_dev == True %}
 {{ kdevops_hosts_prefix }}-dev
playbooks/roles/gen_hosts/templates/ltp.j2 +1 -0
index 5b6ad94..828fd63 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for s in ltp_enabled_hosts %}
 {{ kdevops_host_prefix }}-{{ s }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/nfstest.j2 +1 -0
index fb47471..e427ac3 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for s in nfstest_enabled_hosts %}
 {{ kdevops_host_prefix }}-{{ s }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/pynfs.j2 +1 -0
index cac6fc6..85c87da 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {{ kdevops_hosts_prefix }}-nfsd
 [all:vars]
 ansible_python_interpreter =  "{{ kdevops_python_interpreter }}"
playbooks/roles/gen_hosts/templates/selftests.j2 +1 -0
index 085b733..e505bbf 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for test_type in selftests_enabled_test_types %}
 {{ kdevops_host_prefix }}-{{ test_type }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/gen_hosts/templates/sysbench.j2 +1 -0
index 76503ab..107eebc 100644
@@ -1,4 +1,5 @@
 [all]
+localhost ansible_connection=local
 {% for test_type in enabled_sysbench_tests %}
 {{ kdevops_host_prefix }}-{{ test_type }}
 {% if kdevops_baseline_and_dev %}
playbooks/roles/pkg/README.md +1 -1
index a3309d5..620d9ef 100644
@@ -22,7 +22,7 @@ Below is an example playbook task:
 
 ```
 ---
-- hosts: all
+- hosts: baseline:dev
   roles:
     - role: dpkg
 ```
playbooks/roles/update_etc_hosts/tasks/main.yml +1 -1
index 4c1307f..2b9af91 100644
@@ -26,7 +26,7 @@
 
 - name: Build list of hosts
   set_fact:
-    ueh_hosts: "{{ groups.all | flatten(levels=1) | reject('eq', inventory_hostname) }}"
+    ueh_hosts: "{{ ansible_play_hosts_all | difference([inventory_hostname]) }}"
 
 - debug:
     var: ueh_hosts
playbooks/rxe.yml +1 -1
index a5d058f..03afedc 100644
@@ -1,5 +1,5 @@
 ---
 - name: Set up software-emulated RoCE RDMA over Ethernet (rxe) via udev
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: rxe
playbooks/selftests.yml +1 -1
index 89bc824..8f3ba68 100644
@@ -1,5 +1,5 @@
 ---
 - name: Configure and run Linux kernel selftests (kselftests)
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: selftests
playbooks/siw.yml +1 -1
index e6b9d61..7803827 100644
@@ -1,5 +1,5 @@
 ---
 - name: Set up software-emulated iWARP RDMA over TCP/IP (siw) via udev
-  hosts: all
+  hosts: baseline:dev
   roles:
     - role: siw
playbooks/smbd.yml +1 -1
index ec5176a..a85e99d 100644
@@ -1,5 +1,5 @@
 ---
 - name: Set up Samba server with shared volume and system integration
-  hosts: all
+  hosts: smbd
   roles:
     - role: smbd
playbooks/terraform.yml +2 -3
index 9b5baed..1495296 100644
@@ -1,7 +1,6 @@
 ---
-- name: Provision target nodes with terraform
-  hosts: all
+- name: Manage infrastructure lifecycle and SSH access with Terraform
+  hosts: baseline:dev
   gather_facts: false
-  hosts: all
   roles:
     - role: terraform
playbooks/update_etc_hosts.yml +1 -1
index 269f23c..90cf708 100644
@@ -1,6 +1,6 @@
 ---
 - name: Update target /etc/hosts with all targets and disable cloud-init
-  hosts: all
+  hosts: baseline:dev
   gather_facts: no
   roles:
     - role: update_etc_hosts
scripts/devconfig.Makefile +2 -2
index bdff088..0e5e58c 100644
@@ -57,7 +57,7 @@ extend-extra-args-devconfig:
 PHONY += devconfig
 devconfig: $(KDEVOPS_NODES)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i $(KDEVOPS_HOSTFILE) \
-		-l all,nfsd \
+		--limit 'baseline:dev:nfsd' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml \
 		--extra-vars="$(BOOTLINUX_ARGS)" \
 		--extra-vars '{ kdevops_cli_install: True }' \
@@ -72,7 +72,7 @@ ifeq (y,$(CONFIG_SYSCTL_TUNING))
 PHONY += sysctl-tunings
 sysctl-tunings: $(KDEVOPS_NODES)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i $(KDEVOPS_HOSTFILE) \
-		-l all,nfsd \
+		--limit 'baseline:dev:nfsd' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml \
 		--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags vars,sysctl
 
scripts/guestfs.Makefile +1 -1
index cad1bb3..8bae2ae 100644
@@ -64,7 +64,7 @@ $(KDEVOPS_PROVISIONED_SSH):
 			LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) \
 			$(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
 	fi
-	$(Q)ansible $(ANSIBLE_VERBOSE) -i hosts all -m wait_for_connection
+	$(Q)ansible $(ANSIBLE_VERBOSE) -i hosts 'baseline:dev' -m wait_for_connection
 	$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
 
 install_libguestfs:
workflows/linux/Makefile +1 -1
index f68c090..1e92264 100644
@@ -154,7 +154,7 @@ linux-reboot:
 
 PHONY += uname
 uname:
-	$(Q)ansible all -i hosts -b -m command -a "uname -r" -o \
+	$(Q)ansible 'baseline:dev' -i hosts -b -m command -a "uname -r" -o \
 	| awk -F '|' '{gsub(/^ +| +$$/, "", $$2); printf "%-30s %s\n", $$1, $$4}' \
 	| sed -e 's|(stdout)||'
 
Signature · 1 line
2.50.1
#14 lore raw

PATCH v5 9/12 Makefile: use inventory from ansible.cfg

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

We can define the Ansible inventory via ansible.cfg inventory variable. Make use of it and remove all the -i/--inventory arguments in all the ansible-playbook calls.

Target selection is now handled in two ways:

At the playbook level (hosts: <targets>): E.g. using patterns like all, baseline:dev (which targets all nodes except localhost), or localhost. While all!localhost could be used as an alternative to baseline:dev, it is not semantically correct for kdevops. In addition, all!localhost would prevent playbooks from running on the controller host that also functions as a target node.

So, most of the playbooks have been converted from all -> baseline:dev. Except for bootlinux playbook, where all is kept as the playbook runs limited to localhost in linux-clone-9p and limited to baseline:dev for the rest of the targets.

- At command line: ansible-playbook --limit 'SUBSET': In order to control the hosts when the playbook defines something wider (such as the case where we want to run only on baseline targets for example), we use the ansible-playbook argument --limit.

Use --limits argument with the proper syntax [1]: with quotes and colons (for list of targets or group of targets).

Ensure the target string in CONFIG_ANSIBLE_CFG_INVENTORY excludes the double quotes to avoid the ANSIBLE_CFG_INVENTORY target to be triggered every time.

Also, include support for KDEVOPS_HOSTS via _SET_BY_CLI to keep compatibility with the KDEVOPS_HOSTS Makefile variable that could be overwritten by the user when make was invoked to define a specific hosts file.

[1]
https://docs.ansible.com/ansible/latest/inventory_guide/intro_patterns.html

---
 Makefile                                    | 18 ++++-----
 Makefile.btrfs_progs                        |  4 +-
 Makefile.build_qemu                         | 12 ++----
 Makefile.hypervisor-tunings                 |  3 +-
 Makefile.kdevops                            | 19 +++------
 Makefile.linux-mirror                       |  6 +--
 Makefile.postfix                            |  3 +-
 docs/kdevops-terraform.md                   |  2 +-
 kconfigs/Kconfig.ansible_cfg                |  7 +++-
 playbooks/roles/bootlinux/README.md         | 12 +++---
 playbooks/roles/gen_hosts/defaults/main.yml |  1 -
 playbooks/roles/gen_hosts/tasks/main.yml    | 54 +++++++++++++-------------
 playbooks/roles/guestfs/tasks/main.yml      |  6 +++
 playbooks/roles/libvirt_user/README.md      |  4 +-
 scripts/archive.Makefile                    |  3 +-
 scripts/devconfig.Makefile                  |  4 +-
 scripts/dynamic-pci-kconfig.Makefile        |  3 +-
 scripts/firstconfig.Makefile                |  5 ++-
 scripts/gen-hosts.Makefile                  |  1 -
 scripts/guestfs.Makefile                    | 19 +++++----
 scripts/install-menuconfig-deps.Makefile    |  3 +-
 scripts/iscsi.Makefile                      |  1 -
 scripts/journal-server.Makefile             | 23 ++++++-----
 scripts/kotd.Makefile                       | 16 +++++---
 scripts/krb5.Makefile                       |  2 -
 scripts/ktls.Makefile                       |  1 -
 scripts/nfsd.Makefile                       |  1 -
 scripts/provision.Makefile                  |  5 ++-
 scripts/rdma.Makefile                       |  2 -
 scripts/smbd.Makefile                       |  1 -
 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                    | 60 +++++++++++++++++++----------
 workflows/ltp/Makefile                      |  8 ++--
 workflows/mmtests/Makefile                  | 12 +++---
 workflows/nfstest/Makefile                  |  8 ++--
 workflows/pynfs/Makefile                    | 12 +++---
 workflows/selftests/Makefile                | 11 ++++--
 workflows/steady_state/Makefile             |  8 ++--
 workflows/sysbench/Makefile                 | 12 +++---
 49 files changed, 273 insertions(+), 245 deletions(-)
Makefile +8 -10
index 5369428..2bd3da4 100644
@@ -15,7 +15,6 @@ include Makefile.subtrees
 
 export KDEVOPS_EXTRA_VARS ?=			extra_vars.yaml
 export KDEVOPS_PLAYBOOKS_DIR :=			playbooks
-export KDEVOPS_HOSTFILE ?=			hosts
 export KDEVOPS_NODES :=
 export KDEVOPS_VAGRANT :=
 export PYTHONUNBUFFERED=1
@@ -27,6 +26,8 @@ KDEVOPS_NODES_ROLE_TEMPLATE_DIR :=		$(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/tem
 export KDEVOPS_NODES_TEMPLATE :=
 export KDEVOPS_MRPROPER :=
 
+ANSIBLE_INVENTORY_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_INVENTORY) | tr --delete '"')
+
 KDEVOPS_INSTALL_TARGETS :=
 
 DEFAULT_DEPS :=
@@ -79,8 +80,7 @@ CFLAGS += $(INCLUDES)
 
 ANSIBLE_EXTRA_ARGS += kdevops_version='$(PROJECTRELEASE)'
 
-export KDEVOPS_HOSTS_TEMPLATE := $(KDEVOPS_HOSTFILE).j2
-export KDEVOPS_HOSTS := $(KDEVOPS_HOSTFILE)
+export KDEVOPS_HOSTS_TEMPLATE := hosts.j2
 
 LOCAL_DEVELOPMENT_ARGS	:=
 ifeq (y,$(CONFIG_NEEDS_LOCAL_DEVELOPMENT_PATH))
@@ -226,17 +226,15 @@ ifneq (,$(KDEVOPS_BRING_UP_DEPS))
 include scripts/bringup.Makefile
 endif
 
-DEFAULT_DEPS += $(KDEVOPS_HOSTS)
-$(KDEVOPS_HOSTS): .config ansible.cfg $(KDEVOPS_HOSTS_TEMPLATE)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+DEFAULT_DEPS += $(ANSIBLE_INVENTORY_FILE)
+$(ANSIBLE_INVENTORY_FILE): .config ansible.cfg $(KDEVOPS_HOSTS_TEMPLATE)
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_hosts.yml \
 		--extra-vars=@./extra_vars.yaml
 
 DEFAULT_DEPS += $(KDEVOPS_NODES)
 $(KDEVOPS_NODES) $(KDEVOPS_VAGRANT): .config ansible.cfg $(KDEVOPS_NODES_TEMPLATE)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_nodes.yml \
 		--extra-vars=@./extra_vars.yaml
 
@@ -264,7 +262,7 @@ mrproper:
 	$(Q)rm -rf terraform/*/.terraform
 	$(Q)rm -f terraform/*/.terraform.lock.hcl
 	$(Q)rm -f $(KDEVOPS_NODES)
-	$(Q)rm -f $(KDEVOPS_HOSTFILE) $(KDEVOPS_MRPROPER)
+	$(Q)rm -f $(ANSIBLE_CFG_INVENTORY) $(KDEVOPS_MRPROPER)
 	$(Q)rm -f .config .config.old extra_vars.yaml $(KCONFIG_YAMLCFG)
 	$(Q)rm -f ansible.cfg
 	$(Q)rm -f playbooks/secret.yml $(KDEVOPS_EXTRA_ADDON_DEST)
Makefile.btrfs_progs +2 -2
index 73a1c95..9ccfafa 100644
@@ -5,8 +5,8 @@ BTRFS_PROGS_SETUP_ARGS += btrfs_progs_build=True
 
 PHONY += btrfs-progs
 btrfs-progs: $(KDEVOPS_NODES)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \
-		$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/btrfs-progs.yml \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		$(KDEVOPS_PLAYBOOKS_DIR)/btrfs-progs.yml \
 		--extra-vars=$(BTRFS_PROGS_SETUP_ARGS) $(LIMIT_HOSTS)
 
 btrfs-progs-help-menu:
Makefile.build_qemu +4 -8
index 72e1cba..2eac6e9 100644
@@ -20,29 +20,25 @@ QEMU_BUILD_SETUP_ARGS += qemu_target="ppc64-softmmu"
 endif
 
 qemu: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
 		--extra-vars=@./extra_vars.yaml
 PHONY += qemu
 
 qemu-install: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
 		--extra-vars=@./extra_vars.yaml --tags vars,install
 PHONY += qemu-install
 
 qemu-configure: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
 		--extra-vars=@./extra_vars.yaml --tags vars,configure
 PHONY += qemu-configure
 
 qemu-build: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/build_qemu.yml \
 		--extra-vars=@./extra_vars.yaml --tags vars,build
 PHONY += qemu-build
Makefile.hypervisor-tunings +1 -2
index 39547c0..ff29b89 100644
@@ -14,8 +14,7 @@ HYPERVISOR_TUNING_ARGS += hypervisor_tunning_zswap_max_pool_percent=$(ZSWAP_MAX_
 endif
 
 kdevops_hypervisor_tunning: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/hypervisor-tuning.yml \
 		--extra-vars=@./extra_vars.yaml
 PHONY += kdevops_hypervisor_tunning
Makefile.kdevops +6 -13
index 60d79a5..7a15631 100644
@@ -2,26 +2,22 @@
 # allow your project to define these and just include this file.
 KDEVOPS_TERRAFORM_DIR ?=	terraform
 KDEVOPS_PLAYBOOKS_DIR ?=	playbooks
-KDEVOPS_HOSTFILE ?=		hosts
 KDEVOPS_LOCAL_WORK :=
 
 kdevops_all: kdevops_deps
 PHONY := kdevops_all
 
 kdevops_terraform_deps:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml
 PHONY += kdevops_terraform_deps
 
 kdevops_install_libvirt:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "skip_configuration=True"
 
 kdevops_configure_libvirt:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "skip_install=True" \
 		-e 'running_user=$(USER)'
 
@@ -33,23 +29,20 @@ PHONY += kdevops_vagrant_deps
 KDEVOPS_VAGRANT_WORK := kdevops_vagrant_deps
 
 kdevops_vagrant_boxes:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant_boxes.yml
 PHONY += kdevops_vagrant_boxes
 KDEVOPS_VAGRANT_WORK += kdevops_vagrant_boxes
 
 kdevops_verify_libvirt_user:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/libvirt_user.yml -e "only_verify_user=True"
 
 PHONY += kdevops_verify_libvirt_user
 KDEVOPS_VAGRANT_WORK += kdevops_verify_libvirt_user
 
 kdevops_libvirt_storage_pool_create:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/libvirt_storage_pool_create.yml
 
 PHONY += kdevops_libvirt_storage_pool_create
Makefile.linux-mirror +2 -4
index 6961a55..ccda361 100644
@@ -25,8 +25,7 @@ endif
 MIRROR_CODE      := $(TOPDIR)/playbooks/roles/linux-mirror/linux-mirror-systemd/
 
 kdevops_linux_mirror: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook \
 		--tags vars,mirror \
 		$(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \
 		--extra-vars=@./extra_vars.yaml
@@ -37,8 +36,7 @@ mirror: $(KDEVOPS_EXTRA_VARS) kdevops_linux_mirror
 PHONY += mirror
 
 mirror-status: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook \
 		--tags vars,mirror-status \
 		$(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \
 		--extra-vars=@./extra_vars.yaml
Makefile.postfix +1 -2
index 5db23dc..704c715 100644
@@ -7,8 +7,7 @@ POSTFIX_SETUP_ARGS += postfix_relay_host_setup=True
 POSTFIX_SETUP_ARGS += postfix_relay_host=$(POSTFIX_RELAY_HOST)
 
 kdevops_postfix_setup_relay: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/postfix_relay_host.yml \
 		--extra-vars=@./extra_vars.yaml
 PHONY += kdevos_postfix_setup_relay
docs/kdevops-terraform.md +1 -1
index e6a518c..3291444 100644
@@ -120,7 +120,7 @@ connectivity issues. In such cases, you can run the Ansible role yourself
 manually:
 
 ```bash
-ansible-playbook -i hosts -l kdevops playbooks/devconfig.yml
+ansible-playbook -l kdevops playbooks/devconfig.yml
 ```
 
 Note that there a few configuration items you may have enabled, for things
kconfigs/Kconfig.ansible_cfg +6 -1
index 735160c..a05c8cb 100644
@@ -14,6 +14,10 @@ config ANSIBLE_CFG_TASK_DEBUGGER_SET_BY_CLI
 	bool
 	default $(shell, scripts/check-cli-set-var.sh ANSIBLE_CFG_TASK_DEBUGGER)
 
+config ANSIBLE_CFG_INVENTORY_SET_BY_CLI
+	bool
+	default $(shell, scripts/check-cli-set-var.sh KDEVOPS_HOSTS)
+
 menu "Ansible Callback Plugin Configuration"
 choice
 	prompt "Ansible Callback Plugin"
@@ -227,7 +231,8 @@ config ANSIBLE_CFG_TASK_DEBUGGER
 config ANSIBLE_CFG_INVENTORY
 	string "Ansible inventory sources"
 	output yaml
-	default "$(TOPDIR_PATH)/hosts"
+	default "$(TOPDIR_PATH)/hosts" if !ANSIBLE_CFG_INVENTORY_SET_BY_CLI
+	default $(shell, ./scripts/append-makefile-vars-int.sh $(KDEVOPS_HOSTS)) if ANSIBLE_CFG_INVENTORY_SET_BY_CLI
 	help
 	  Comma-separated list of Ansible inventory source paths.
 
playbooks/roles/bootlinux/README.md +6 -6
index 8c0b1d5..5179f49 100644
@@ -78,7 +78,7 @@ You can compile say a vanilla kernel v4.19.58 with an extra set of patches we'd
 
 ```
 cd ansible
-ansible-playbook -i hosts -l dev --extra-vars "target_linux_extra_patch=pend-v4.19.58-fixes-20190716-v2.patch" bootlinux.yml
+ansible-playbook -l dev --extra-vars "target_linux_extra_patch=pend-v4.19.58-fixes-20190716-v2.patch" bootlinux.yml
 ```
 
 You'd place the `pend-v4.19.58-fixes-20190716-v2.patch` file on the directory
@@ -87,19 +87,19 @@ You'd place the `pend-v4.19.58-fixes-20190716-v2.patch` file on the directory
 Now say you wantd to be explicit about a tag of Linux you'd want to use:
 
 ```
-ansible-playbook -i hosts -l dev --extra-vars "target_linux_ref=v4.19.21 "target_linux_extra_patch=try-v4.19.20-fixes-20190716-v1.patch" bootlinux.yml
+ansible-playbook -l dev --extra-vars "target_linux_ref=v4.19.21 "target_linux_extra_patch=try-v4.19.20-fixes-20190716-v1.patch" bootlinux.yml
 ```
 
 To uninstall a kernel:
 
 ```
-ansible-playbook -i hosts -l dev --tags uninstall-linux --extra-vars "uninstall_kernel_ver=4.19.58+" bootlinux.yml
+ansible-playbook -l dev --tags uninstall-linux --extra-vars "uninstall_kernel_ver=4.19.58+" bootlinux.yml
 ```
 
 To ensure you can get the grub prompt:
 
 ```bash
-ansible-playbook -i hosts --tags vars,manual-update-grub playbooks/bootlinux.yml
+ansible-playbook --tags vars,manual-update-grub playbooks/bootlinux.yml
 ```
 
 The ansible bootlinux role relies on the create_partition role to create a data
@@ -107,13 +107,13 @@ partition where we can stuff code, and compile it. To test that aspect of
 the bootlinux role you can run:
 
 ```
-ansible-playbook -i hosts -l baseline --tags data_partition,partition bootlinux.yml
+ansible-playbook -l baseline --tags data_partition,partition bootlinux.yml
 ```
 
 To reboot all hosts:
 
 ```bash
-ansible-playbook -i hosts bootlinux.yml --tags reboot
+ansible-playbook bootlinux.yml --tags reboot
 ```
 
 For further examples refer to one of this role's users, the
playbooks/roles/gen_hosts/defaults/main.yml +0 -1
index d621a0b..9770e3c 100644
@@ -6,7 +6,6 @@ hosts_type_generic: True
 hosts_type_fs: False
 hosts_type_block: False
 
-kdevops_hosts: "hosts"
 kdevops_hosts_template: "hosts.in"
 kdevops_playbooks_dir: "/dev/null"
 kdevops_genhosts_templates_dir: "/dev/null"
playbooks/roles/gen_hosts/tasks/main.yml +27 -27

180 lines not on this page · raw message

playbooks/roles/guestfs/tasks/main.yml +6 -0
index d6530f8..644922b 100644
@@ -23,6 +23,7 @@
     - bringup
   ansible.builtin.set_fact:
     storagedir: "{{ kdevops_storage_pool_path }}/guestfs"
+  delegate_to: localhost
 
 - name: Set the pathname of the OS base image
   tags:
@@ -30,6 +31,7 @@
     - bringup
   ansible.builtin.set_fact:
     base_image: "{{ storagedir }}/base_images/{{ virtbuilder_os_version }}.raw"
+  delegate_to: localhost
 
 - name: Ensure the required base OS image exists
   tags:
@@ -39,12 +41,14 @@
   vars:
     base_image_os_version: "{{ virtbuilder_os_version }}"
     base_image_pathname: "{{ base_image }}"
+  delegate_to: localhost
 
 - name: Bring up each target node
   tags:
     - bringup
   ansible.builtin.import_tasks:
     file: "{{ role_path }}/tasks/bringup/main.yml"
+  delegate_to: localhost
 
 - name: Set up target node console permissions
   tags:
@@ -53,9 +57,11 @@
     file: "{{ role_path }}/tasks/bringup/console-permissions.yml"
   when:
     - libvirt_uri_system|bool
+  delegate_to: localhost
 
 - name: Shut down and destroy each target node
   tags:
     - destroy
   ansible.builtin.import_tasks:
     file: "{{ role_path }}/tasks/destroy.yml"
+  delegate_to: localhost
playbooks/roles/libvirt_user/README.md +2 -2
index 2120e84..7a0e034 100644
@@ -65,11 +65,11 @@ take effect So for instance you would have:
 
 ```bash
 # Does the actual work
-ansible-playbook -i hosts playbooks/libvirt_user.yml
+ansible-playbook playbooks/libvirt_user.yml
 
 # Verify if the changes are already effective if not warn the user to log
 # out and back in.
-ansible-playbook -i hosts playbooks/libvirt_user.yml -e "only_verify_user=True"
+ansible-playbook playbooks/libvirt_user.yml -e "only_verify_user=True"
 ```
 
 ## Running libvirt as a regular user
scripts/archive.Makefile +1 -2
index 54928d3..23a693d 100644
@@ -13,8 +13,7 @@ ARCHIVE_DYNAMIC_RUNTIME_VARS += \
 endif
 
 ci-archive:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/kdevops_archive.yml \
 		--extra-vars '{ $(ARCHIVE_DYNAMIC_RUNTIME_VARS) }' \
 		--extra-vars=@./extra_vars.yaml
scripts/devconfig.Makefile +2 -2
index 0e5e58c..146c70f 100644
@@ -56,7 +56,7 @@ extend-extra-args-devconfig:
 
 PHONY += devconfig
 devconfig: $(KDEVOPS_NODES)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i $(KDEVOPS_HOSTFILE) \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		--limit 'baseline:dev:nfsd' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml \
 		--extra-vars="$(BOOTLINUX_ARGS)" \
@@ -71,7 +71,7 @@ HELP_TARGETS+=devconfig-generic-help-menu
 ifeq (y,$(CONFIG_SYSCTL_TUNING))
 PHONY += sysctl-tunings
 sysctl-tunings: $(KDEVOPS_NODES)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i $(KDEVOPS_HOSTFILE) \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		--limit 'baseline:dev:nfsd' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml \
 		--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags vars,sysctl
scripts/dynamic-pci-kconfig.Makefile +1 -2
index 716cdc1..8902da2 100644
@@ -42,8 +42,7 @@ endif # CONFIG_KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
 HELP_TARGETS += dynamic-kconfig-pci-help
 
 dynamic_pcipassthrough_kconfig:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/gen-pci-kconfig.yml \
 		--extra-vars '{ $(PCIE_RUNTIME_VARS) }'
 
scripts/firstconfig.Makefile +3 -2
index f1a4423..9f8a63a 100644
@@ -1,8 +1,9 @@
 # SPDX-License-Identifier: copyleft-next-0.3.1
 
 firstconfig:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --extra-vars '{ kdevops_cli_install: True }' \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--extra-vars '{ kdevops_cli_install: True }' \
 		--tags vars_simple,firstconfig \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
scripts/gen-hosts.Makefile +0 -1
index 84e47fd..0d1e0cd 100644
@@ -4,7 +4,6 @@ KDEVOPS_PLAYBOOKS_DIR_FULL_PATH=$(TOPDIR_PATH)/$(KDEVOPS_PLAYBOOKS_DIR)
 KDEVOPS_HOSTS_TEMPLATE_DIR=$(KDEVOPS_PLAYBOOKS_DIR_FULL_PATH)/roles/gen_hosts/templates
 
 GENHOSTS_EXTRA_ARGS += kdevops_playbooks_dir='$(KDEVOPS_PLAYBOOKS_DIR)'
-GENHOSTS_EXTRA_ARGS += kdevops_hosts='$(KDEVOPS_HOSTFILE)'
 
 # Relative path so that ansible can work with it
 KDEVOPS_HOSTS_TEMPLATE_SHORT:=$(KDEVOPS_HOSTS_TEMPLATE)
scripts/guestfs.Makefile +9 -10
index 8bae2ae..bd03f58 100644
@@ -51,41 +51,40 @@ KDEVOPS_PROVISION_DESTROY_METHOD	:= destroy_guestfs
 	$(Q)make linux-clone
 
 libvirt_pcie_passthrough_permissions:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/libvirt_pcie_passthrough.yml
 
 $(KDEVOPS_PROVISIONED_SSH):
 	$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
-		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-			--inventory localhost, \
+		ansible-playbook $(ANSIBLE_VERBOSE) \
 			playbooks/update_ssh_config_guestfs.yml \
 			--extra-vars=@./extra_vars.yaml; \
 			LIBVIRT_DEFAULT_URI=$(CONFIG_LIBVIRT_URI) \
 			$(TOPDIR)/scripts/update_ssh_config_guestfs.py; \
 	fi
-	$(Q)ansible $(ANSIBLE_VERBOSE) -i hosts 'baseline:dev' -m wait_for_connection
+	$(Q)ansible $(ANSIBLE_VERBOSE) 'baseline:dev:service' -m wait_for_connection
 	$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
 
 install_libguestfs:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		--inventory localhost, \
+		--limit 'localhost' \
 		playbooks/guestfs.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags install-deps
 
 bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		--connection=local --inventory localhost, \
+		--limit 'localhost' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags network,pool,base_image
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/guestfs.yml \
+		--limit 'baseline:dev:service' \
+		playbooks/guestfs.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags bringup
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		--connection=local --inventory localhost, \
+		--limit 'localhost' \
 		$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags console
@@ -97,7 +96,7 @@ PHONY += status_guestfs
 
 destroy_guestfs:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/guestfs.yml \
+		playbooks/guestfs.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags destroy
 	$(Q)rm -f $(KDEVOPS_PROVISIONED_SSH) $(KDEVOPS_PROVISIONED_DEVCONFIG)
scripts/install-menuconfig-deps.Makefile +1 -2
index 772e65d..4b9aef8 100644
@@ -1,8 +1,7 @@
 # SPDX-License-Identifier: copyleft-next-0.3.1
 
 menuconfig-deps:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install-menuconfig-deps.yml \
 		-e 'kdevops_first_run=True'
 PHONY += menuconfig-deps
scripts/iscsi.Makefile +0 -1
index d9ac22b..a647c2b 100644
@@ -7,7 +7,6 @@ ANSIBLE_EXTRA_ARGS += $(ISCSI_EXTRA_ARGS)
 
 iscsi:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l iscsi \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/iscsi.yml
 
scripts/journal-server.Makefile +13 -10
index da61fa3..d3c3971 100644
@@ -11,24 +11,26 @@ ANSIBLE_EXTRA_ARGS += devconfig_systemd_journal_use_http='True'
 endif
 
 journal-client:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --extra-vars '{ kdevops_cli_install: True }' \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--extra-vars '{ kdevops_cli_install: True }' \
 		--tags vars_simple,journal \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
 journal-server:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_journal_remote.yml
 
 journal-restart:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --tags vars_extra,journal-upload-restart \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--tags vars_extra,journal-upload-restart \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
 journal-status:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --tags vars_extra,journal-status \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--tags vars_extra,journal-status \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
 journal-ls:
@@ -39,8 +41,9 @@ journal-dump:
 
 
 journal-ln:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --tags vars_extra,journal_ln \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--tags vars_extra,journal_ln \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
 LOCALHOST_SETUP_WORK += journal-server
scripts/kotd.Makefile +10 -6
index b9b7cf6..c74aad5 100644
@@ -9,19 +9,23 @@ endif # HAVE_DISTRO_CUSTOM_KOTD_REPO
 
 ANSIBLE_CMD_KOTD_ENABLE :=
 
-kotd: $(KDEVOPS_HOSTS) .config
+kotd: inventory .config
 	$(Q)$(ANSIBLE_CMD_KOTD_ENABLE)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/devconfig.yml --tags vars,kotd \
+		playbooks/devconfig.yml --tags vars,kotd \
 		--extra-vars=@./extra_vars.yaml
 
-kotd-baseline: $(KDEVOPS_HOSTS) .config
+kotd-baseline: inventory .config
 	$(Q)$(ANSIBLE_CMD_KOTD_ENABLE)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/devconfig.yml --tags vars,kotd \
+		--limit 'baseline' \
+		playbooks/devconfig.yml \
+		--tags vars,kotd \
 		--extra-vars=@./extra_vars.yaml
 
-kotd-dev: $(KDEVOPS_HOSTS) .config
+kotd-dev: inventory .config
 	$(Q)$(ANSIBLE_CMD_KOTD_ENABLE)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/devconfig.yml --tags vars,kotd \
+		--limit 'dev' \
+		playbooks/devconfig.yml \
+		--tags vars,kotd \
 		--extra-vars=@./extra_vars.yaml
 
 kotd-help-menu:
scripts/krb5.Makefile +0 -2
index d49e77b..a414fc8 100644
@@ -8,13 +8,11 @@ ANSIBLE_EXTRA_ARGS += $(KRB5_EXTRA_ARGS)
 
 kdc:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l kdc \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/kdc.yml
 
 krb5:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l krb5 \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/krb5.yml
 
scripts/ktls.Makefile +0 -1
index ee1de73..83a8dbe 100644
@@ -2,7 +2,6 @@ ifeq (y,$(CONFIG_KDEVOPS_SETUP_KTLS))
 
 ktls:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ktls.yml
 
scripts/nfsd.Makefile +0 -1
index 79b9801..9293353 100644
@@ -29,7 +29,6 @@ ANSIBLE_EXTRA_ARGS += $(NFSD_EXTRA_ARGS)
 
 nfsd:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l nfsd \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/nfsd.yml
 
scripts/provision.Makefile +3 -2
index 92a7541..59d68ab 100644
@@ -69,8 +69,9 @@ KDEVOPS_MRPROPER += $(KDEVOPS_PROVISIONED_DEVCONFIG)
 
 $(KDEVOPS_PROVISIONED_DEVCONFIG):
 	$(Q)if [[ "$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)" != "" ]]; then \
-		ansible-playbook $(ANSIBLE_VERBOSE) -i \
-			$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
+		ansible-playbook $(ANSIBLE_VERBOSE) \
+			--limit 'baseline:dev' \
+			$(KDEVOPS_PLAYBOOKS_DIR)/$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK) ;\
 	fi
 	$(Q)touch $(KDEVOPS_PROVISIONED_DEVCONFIG)
 
scripts/rdma.Makefile +0 -2
index 5c8b60d..c63b63a 100644
@@ -2,7 +2,6 @@ ifeq (y,$(CONFIG_KDEVOPS_SETUP_RDMA_SIW))
 
 siw:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/siw.yml
 
@@ -16,7 +15,6 @@ ifeq (y,$(CONFIG_KDEVOPS_SETUP_RDMA_RXE))
 
 rxe:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/rxe.yml
 
scripts/smbd.Makefile +0 -1
index 1be5b93..3101e97 100644
@@ -9,7 +9,6 @@ ANSIBLE_EXTRA_ARGS += $(SMBD_EXTRA_ARGS)
 
 smbd:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l smbd \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/smbd.yml
 
scripts/systemd-timesync.Makefile +4 -4
index 9b84b4a..148bf17 100644
@@ -20,14 +20,14 @@ ANSIBLE_EXTRA_ARGS += devconfig_enable_systemd_timesyncd_ntp_google_debian='True
 endif
 
 timesyncd-client:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts --extra-vars '{ kdevops_cli_install: True }' \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		--extra-vars '{ kdevops_cli_install: True }' \
 		--tags vars_simple,timesyncd \
 		$(KDEVOPS_PLAYBOOKS_DIR)/devconfig.yml
 
 timesyncd-server:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/install_systemd_timesyncd.yml
 
 timesyncd-status:
scripts/terraform.Makefile +1 -5
index 865c84c..c288369 100644
@@ -101,13 +101,11 @@ ANSIBLE_EXTRA_ARGS += $(TERRAFORM_EXTRA_VARS)
 
 bringup_terraform:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		--connection=local --inventory localhost, \
 		playbooks/terraform.yml --tags bringup \
 		--extra-vars=@./extra_vars.yaml
 
 $(KDEVOPS_PROVISIONED_SSH):
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) \
 		playbooks/terraform.yml --tags ssh \
 		--extra-vars=@./extra_vars.yaml
 	$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
@@ -117,13 +115,11 @@ status_terraform:
 
 destroy_terraform:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		--connection=local -i $(KDEVOPS_HOSTFILE) \
 		playbooks/terraform.yml --tags destroy \
 		--extra-vars=@./extra_vars.yaml
 	$(Q)rm -f $(KDEVOPS_PROVISIONED_SSH) $(KDEVOPS_PROVISIONED_DEVCONFIG)
 
 $(KDEVOPS_TFVARS): $(KDEVOPS_TFVARS_TEMPLATE) .config
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_tfvars.yml \
 		--extra-vars=@./extra_vars.yaml
scripts/update_etc_hosts.Makefile +1 -1
index 4da15ea..5fb90e9 100644
@@ -1,6 +1,6 @@
 update_etc_hosts:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/update_etc_hosts.yml
+		playbooks/update_etc_hosts.yml
 
 KDEVOPS_BRING_UP_DEPS_EARLY += update_etc_hosts
 
scripts/vagrant.Makefile +4 -6
index e43a21d..2c97f46 100644
@@ -80,21 +80,19 @@ extend-extra-args-vagrant:
 	fi
 
 vagrant_private_box_install:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \
-		$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant_boxes.yml
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		$(KDEVOPS_PLAYBOOKS_DIR)/install_vagrant_boxes.yml
 
 vagrant_9p_linux_clone:
 	$(Q)make linux-clone
 
 libvirt_pcie_passthrough_permissions:
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/libvirt_pcie_passthrough.yml
 
 $(KDEVOPS_PROVISIONED_SSH):
 	$(Q)if [[ "$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE)" == "y" ]]; then \
-		ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-			--inventory localhost, \
+		ansible-playbook $(ANSIBLE_VERBOSE) \
 			playbooks/update_ssh_config_vagrant.yml
 	fi
 	$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
scripts/workflows/lib/crash.py +1 -3
index 663de93..d9d121d 100755
@@ -769,9 +769,7 @@ class KernelCrashWatchdog:
             subprocess.run(
                 [
                     "ansible",
-                    "-i",
-                    "hosts",
-                    "all",
+                    "'baseline:dev'",
                     "-m",
                     "wait_for_connection",
                     "-l",
workflows/blktests/Makefile +13 -7
index 33fb648..92c96ba 100644
@@ -67,12 +67,13 @@ extend-extra-args-blktests:
 
 blktests:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/blktests.yml \
+		playbooks/blktests.yml \
 		--skip-tags run_tests,copy_results $(LIMIT_HOSTS)
 
 blktests-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/blktests.yml \
+		--limit 'baseline' \
+		playbooks/blktests.yml \
 		--tags run_tests,copy_results \
 		--extra-vars '{ $(BLKTESTS_DYNAMIC_RUNTIME_VARS) }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
@@ -85,14 +86,16 @@ blktests-baseline-kernelci:
 
 blktests-baseline-skip-kdevops-update:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/blktests.yml \
+		--limit 'baseline' \
+		playbooks/blktests.yml \
 		--tags run_tests,copy_results --skip-tags git_update \
 		--extra-vars '{ $(BLKTESTS_DYNAMIC_RUNTIME_VARS) }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
 
 blktests-baseline-run-oscheck-only:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/blktests.yml \
+		--limit 'baseline' \
+		playbooks/blktests.yml \
 		--tags run_tests,copy_results \
 		--skip-tags git_update,reboot,clean_results \
 		--extra-vars '{ $(BLKTESTS_DYNAMIC_RUNTIME_VARS) }' \
@@ -100,14 +103,16 @@ blktests-baseline-run-oscheck-only:
 
 blktests-dev:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/blktests.yml \
+		--limit 'dev' \
+		playbooks/blktests.yml \
 		--tags run_tests,copy_results \
 		--extra-vars '{ $(BLKTESTS_DYNAMIC_RUNTIME_VARS) }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
 
 blktests-baseline-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/blktests.yml \
+		--limit 'baseline' \
+		playbooks/blktests.yml \
 		--tags copy_results,print_results \
 		--extra-vars '{ kdevops_run_blktests: True }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
@@ -116,7 +121,8 @@ blktests-results: blktests-baseline-results
 
 blktests-dev-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/blktests.yml \
+		--limit 'dev' \
+		playbooks/blktests.yml \
 		--tags copy_results,print_results \
 		--extra-vars '{ kdevops_run_blktests: True }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
workflows/common/Makefile +1 -1
index cfbebeb..9ae0a0a 100644
@@ -38,7 +38,7 @@ endif # CONFIG_WORKFLOW_INFER_USER_AND_GROUP == y
 ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_GIT_CLONES_KDEVOPS_GIT))
 kdevops-git-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/common.yml --tags vars,kdevops_reset \
+		playbooks/common.yml --tags vars,kdevops_reset \
 		--extra-vars '{ kdevops_git_reset: True }' $(LIMIT_HOSTS)
 
 kdevops-help-menu:
workflows/cxl/Makefile +7 -7
index 11d3e85..bb13005 100644
@@ -20,42 +20,42 @@ include $(TOPDIR)/workflows/cxl/Makefile.kernel
 
 cxl:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--skip-tags run_tests,copy_results \
 		$(LIMIT_HOSTS)
 
 cxl-test-probe:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,cxl-test-prep,cxl-test-probe \
 		--extra-vars '{ $(CXL_DYNAMIC_RUNTIME_VARS) }' \
 		$(LIMIT_HOSTS)
 
 cxl-test-meson:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,cxl-test-prep,cxl-test-meson \
 		--extra-vars '{ $(CXL_DYNAMIC_RUNTIME_VARS) }' \
 		$(LIMIT_HOSTS)
 
 cxl-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,copy_results $(LIMIT_HOSTS)
 
 cxl-mem-setup:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,extra-vars,cxl-mem-setup $(LIMIT_HOSTS)
 
 cxl-create-dc-region:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,cxl-create-dc-region $(LIMIT_HOSTS)
 
 cxl-dcd-setup:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/cxl.yml \
+		playbooks/cxl.yml \
 		--tags vars,cxl-dcd-setup $(LIMIT_HOSTS)
 
 cxl-help-menu:
workflows/demos/reboot-limit/Makefile +21 -11
index a6b4aaf..e4cbf29 100644
@@ -25,7 +25,7 @@ REBOOT_LIMIT_TEST_TYPE :=$(subst ",,$(CONFIG_REBOOT_LIMIT_TEST_TYPE))
 # into the file extra_vars.yaml. The extra_vars.yaml file is always used as an
 # argument to ansible so that it reads our manually converted kconfig varibles
 # in ansible. We typically call a playbook with something like:
-# ansible-playbook -i hosts -l baseline playbooks/foo.yml --tags bar --extra-vars=@./extra_vars.yaml
+# ansible-playbook -l baseline playbooks/foo.yml --tags bar --extra-vars=@./extra_vars.yaml
 #
 # Likewise most playbooks also have something like the following as their first
 # task in their playbooks, so that they don't have to be specifying the
@@ -104,7 +104,7 @@ endif # CONFIG_KERNEL_CI
 # with tags "run_tests" or "copy_results".
 reboot-limit:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/reboot-limit.yml \
+		playbooks/reboot-limit.yml \
 		--skip-tags run_tests,copy_results
 
 # kdevops supports generic workflows such as the enabling you to then use the
@@ -134,10 +134,13 @@ reboot-limit:
 # fly.
 reboot-limit-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/reboot-limit.yml \
-		--tags vars,first_run,reset --extra-vars=@./extra_vars.yaml
+		--limit 'baseline' \
+		playbooks/reboot-limit.yml \
+		--tags vars,first_run,reset \
+		--extra-vars=@./extra_vars.yaml
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/reboot-limit.yml \
+		--limit 'baseline' \
+		playbooks/reboot-limit.yml \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml
 
@@ -155,16 +158,21 @@ reboot-limit-baseline-kernelci:
 # Resets the boot counters so we start from scratch
 reboot-limit-baseline-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/reboot-limit.yml \
-		--tags vars,reset --extra-vars=@./extra_vars.yaml
+		--limit 'baseline' \
+		playbooks/reboot-limit.yml \
+		--tags vars,reset \
+		--extra-vars=@./extra_vars.yaml
 
 # Below are the corresponding dev targets
 reboot-limit-dev-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/reboot-limit.yml \
-		--tags vars,first_run,reset --extra-vars=@./extra_vars.yaml
+		--limit 'dev' \
+		playbooks/reboot-limit.yml \
+		--tags vars,first_run,reset \
+		--extra-vars=@./extra_vars.yaml
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/reboot-limit.yml \
+		--limit 'dev' \
+		playbooks/reboot-limit.yml \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml
 
@@ -176,7 +184,9 @@ reboot-limit-dev-kernelci:
 
 reboot-limit-dev-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/reboot-limit.yml --tags vars,reset \
+		--limit 'dev' \
+		playbooks/reboot-limit.yml \
+		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml
 
 reboot-limit-help-menu:
workflows/fstests/Makefile +25 -15
index a5e307b..48790d9 100644
@@ -138,19 +138,22 @@ endif
 endif
 
 fstests: $(FSTESTS_BASELINE_EXTRA)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l localhost,baseline,dev \
-		-i hosts playbooks/fstests.yml \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'localhost:baseline:dev' \
+		playbooks/fstests.yml \
 		--skip-tags run_tests,copy_results $(LIMIT_HOSTS)
 
 fstests-kdevops-setup: $(KDEVOPS_EXTRA_VARS) $(FSTESTS_BASELINE_EXTRA)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
-		-i hosts playbooks/fstests.yml \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		--limit 'baseline:dev' \
+		playbooks/fstests.yml \
 		--tags vars,kdevops_fstests_setup,gendisks \
 		$(LIMIT_HOSTS)
 
 fstests-baseline: $(FSTESTS_BASELINE_EXTRA)
 	$(Q)PYTHONUNBUFFERED=1 ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags vars,run_tests,copy_results \
 		--extra-vars '{ $(FSTESTS_DYNAMIC_RUNTIME_VARS) }' \
 		--extra-vars=@./extra_vars.yaml $(LIMIT_HOSTS)
@@ -163,7 +166,8 @@ fstests-baseline-kernelci: $(KDEVOPS_EXTRA_VARS)
 
 fstests-baseline-skip-kdevops-update: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags run_tests,copy_results \
 		--skip-tags git_update \
 		--extra-vars \
@@ -173,7 +177,8 @@ fstests-baseline-skip-kdevops-update: $(KDEVOPS_EXTRA_VARS)
 
 fstests-baseline-run-oscheck-only: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags run_tests,copy_results \
 		--skip-tags git_update,reboot,clean_results \
 		--extra-vars \
@@ -183,14 +188,14 @@ fstests-baseline-run-oscheck-only: $(KDEVOPS_EXTRA_VARS)
 
 fstests-config: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags vars,generate-fstests-config \
 		--extra-vars=@./extra_vars.yaml \
 		$(LIMIT_HOSTS)
 
 fstests-config-debug: $(KDEVOPS_EXTRA_VARS)
-	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
-		--inventory localhost, \
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/fstests.yml \
 		-e 'fstests_debug_localhost=True' \
 		--tags vars,generate-fstests-config \
@@ -198,7 +203,8 @@ fstests-config-debug: $(KDEVOPS_EXTRA_VARS)
 
 fstests-dev: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/fstests.yml \
+		--limit 'dev' \
+		playbooks/fstests.yml \
 		--tags vars,run_tests,copy_results \
 		--extra-vars \
 		'{ $(FSTESTS_DYNAMIC_RUNTIME_VARS) }' \
@@ -206,7 +212,8 @@ fstests-dev: $(KDEVOPS_EXTRA_VARS)
 
 fstests-baseline-results-tfb-ls: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags vars,tfb \
 		--skip-tags copy_final \
 		--extra-vars \
@@ -215,7 +222,8 @@ fstests-baseline-results-tfb-ls: $(KDEVOPS_EXTRA_VARS)
 
 fstests-baseline-results-tfb-trim: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags vars,tfb \
 		--skip-tags copy_final \
 		--extra-vars \
@@ -224,7 +232,8 @@ fstests-baseline-results-tfb-trim: $(KDEVOPS_EXTRA_VARS)
 
 fstests-baseline-results: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/fstests.yml \
+		--limit 'baseline' \
+		playbooks/fstests.yml \
 		--tags copy_results,print_results,tfb \
 		--extra-vars '{ kdevops_run_fstests: True }' \
 		--extra-vars=@./extra_vars.yaml \
@@ -234,7 +243,8 @@ fstests-results: fstests-baseline-results
 
 fstests-dev-results: $(KDEVOPS_EXTRA_VARS)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/fstests.yml \
+		--limit 'dev' \
+		playbooks/fstests.yml \
 		--tags copy_results,print_results \
 		--extra-vars '{ kdevops_run_fstests: True }' \
 		--extra-vars=@./extra_vars.yaml \
workflows/gitr/Makefile +4 -4
index b8a1b3a..09ef466 100644
@@ -90,13 +90,13 @@ endif
 
 gitr:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline,dev \
+		--limit 'baseline:dev' \
 		--skip-tags run_tests,run_specific_tests,copy_results \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gitr.yml
 
 gitr-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline \
+		--limit 'baseline' \
 		--tags $(GITR_PLAY_TAGS) \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gitr.yml
@@ -109,7 +109,7 @@ gitr-baseline-kernelci:
 
 gitr-dev-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags $(GITR_PLAY_TAGS) \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gitr.yml
@@ -122,7 +122,7 @@ gitr-dev-kernelci:
 
 gitr-dev-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gitr.yml
workflows/linux/Makefile +39 -21

121 lines not on this page · raw message

workflows/ltp/Makefile +4 -4
index 081e836..ddbdf73 100644
@@ -116,13 +116,13 @@ endif
 
 ltp:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline,dev \
+		--limit 'baseline:dev' \
 		--skip-tags run_tests,copy_results \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ltp.yml
 
 ltp-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline \
+		--limit 'baseline' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ltp.yml
@@ -135,7 +135,7 @@ ltp-baseline-kernelci:
 
 ltp-dev-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ltp.yml
@@ -148,7 +148,7 @@ ltp-dev-kernelci:
 
 ltp-dev-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ltp.yml
workflows/mmtests/Makefile +6 -6
index cfccd6b..06a75ea 100644
@@ -6,42 +6,42 @@ endif
 
 mmtests:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/mmtests.yml \
+		playbooks/mmtests.yml \
 		--extra-vars=@./extra_vars.yaml  \
 		--tags deps,setup
 		$(MMTESTS_ARGS)
 
 mmtests-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/mmtests.yml
+		-l baseline playbooks/mmtests.yml
 		--extra-vars=@./extra_vars.yaml  \
 		--tags run_tests \
 		$(MMTESTS_ARGS)
 
 mmtests-dev:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l dev playbooks/mmtests.yml \
+		-l dev playbooks/mmtests.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags run_tests \
 		$(MMTESTS_ARGS)
 
 mmtests-test: mmtests
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/mmtests.yml \
+		playbooks/mmtests.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags run_tests,results \
 		$(MMTESTS_ARGS)
 
 mmtests-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/mmtests.yml \
+		playbooks/mmtests.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags results \
 		$(MMTESTS_ARGS)
 
 mmtests-clean:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/mmtests.yml \
+		playbooks/mmtests.yml \
 		--extra-vars=@./extra_vars.yaml \
 		--tags clean \
 		$(MMTESTS_ARGS)
workflows/nfstest/Makefile +4 -4
index 80c00c1..3945edf 100644
@@ -73,13 +73,13 @@ endif
 
 nfstest:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline,dev \
+		--limit 'baseline:dev' \
 		--skip-tags run_tests,copy_results \
 		$(KDEVOPS_PLAYBOOKS_DIR)/nfstest.yml
 
 nfstest-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline \
+		--limit 'baseline' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/nfstest.yml
@@ -92,7 +92,7 @@ nfstest-baseline-kernelci:
 
 nfstest-dev-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/nfstest.yml
@@ -105,7 +105,7 @@ nfstest-dev-kernelci:
 
 nfstest-dev-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/nfstest.yml
workflows/pynfs/Makefile +6 -6
index dc4b29c..1dfd349 100644
@@ -45,18 +45,18 @@ endif
 # Makefile for pynfs targets
 pynfs:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline,dev \
+		--limit 'baseline:dev' \
 		--skip-tags run_tests,copy_results,clean_local_results \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
 
 pynfs-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline \
+		--limit 'baseline' \
 		--tags vars,first_run,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l baseline \
+		--limit 'baseline' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
@@ -75,12 +75,12 @@ pynfs-baseline-kernelci:
 # Below are the corresponding dev targets
 pynfs-dev-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,first_run,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,run_tests,copy_results \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
@@ -93,7 +93,7 @@ pynfs-dev-kernelci:
 
 pynfs-dev-reset:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i $(KDEVOPS_HOSTFILE) -l dev \
+		--limit 'dev' \
 		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml \
 		$(KDEVOPS_PLAYBOOKS_DIR)/pynfs.yml
workflows/selftests/Makefile +7 -4
index 075da61..d3b7044 100644
@@ -33,24 +33,27 @@ include $(TOPDIR)/workflows/selftests/tests/Makefile.xarray
 
 selftests:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/selftests.yml \
+		playbooks/selftests.yml \
 		--skip-tags run_tests,copy_results,check_results \
 		$(LIMIT_HOSTS)
 
 selftests-baseline:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/selftests.yml \
+		--limit 'baseline' \
+		playbooks/selftests.yml \
 		--extra-vars '{ $(SELFTESTS_DYNAMIC_RUNTIME_VARS) }' \
 		--tags vars,run_tests,copy_results,check_results $(LIMIT_HOSTS)
 
 selftests-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/selftests.yml \
+		--limit 'baseline' \
+		playbooks/selftests.yml \
 		--tags vars,copy_results,check_results $(LIMIT_HOSTS)
 
 selftests-check-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts -l baseline playbooks/selftests.yml \
+		--limit 'baseline' \
+		playbooks/selftests.yml \
 		--tags vars,check_results $(LIMIT_HOSTS)
 
 selftests-help-main:
workflows/steady_state/Makefile +4 -4
index 514bd47..66a4801 100644
@@ -8,22 +8,22 @@ SSD_STEADY_STATE_DYNAMIC_RUNTIME_VARS := "kdevops_run_ssd_steady_state": True
 
 steady-state-files:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-	-i $(KDEVOPS_HOSTFILE) playbooks/steady_state.yml \
+	playbooks/steady_state.yml \
 	--extra-vars=@./extra_vars.yaml --tags vars,setup $(LIMIT_HOSTS)
 
 steady-state-prefill:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-	-i $(KDEVOPS_HOSTFILE) playbooks/steady_state.yml \
+	playbooks/steady_state.yml \
 	--extra-vars=@./extra_vars.yaml --tags vars,prefill $(LIMIT_HOSTS)
 
 steady-state-run:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-	-i $(KDEVOPS_HOSTFILE) playbooks/steady_state.yml \
+	playbooks/steady_state.yml \
 	--extra-vars=@./extra_vars.yaml --tags vars,steady_state $(LIMIT_HOSTS)
 
 steady-state:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-	-i $(KDEVOPS_HOSTFILE) playbooks/steady_state.yml \
+	playbooks/steady_state.yml \
 	--extra-vars '{ $(SSD_STEADY_STATE_DYNAMIC_RUNTIME_VARS) }' $(LIMIT_HOSTS)
 
 steady-state-help-menu:
workflows/sysbench/Makefile +6 -6
index 21cb297..daf7bc7 100644
@@ -29,36 +29,36 @@ TAGS_SYSBENCH_RESULTS += results
 # Target to set up sysbench (MySQL or PostgreSQL)
 sysbench:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--skip-tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_RUN))
 
 # Target to run sysbench tests (including telemetry)
 sysbench-test:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_TEST))
 
 # Optional target to collect telemetry
 sysbench-telemetry:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_TELEMETRY))
 
 # Optional target to collect all results
 sysbench-results:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_RESULTS))
 
 sysbench-clean:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--tags vars,clean
 
 # Optional in case you want to improve graphing
 sysbench-plot:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-		-i hosts playbooks/sysbench.yml \
+		playbooks/sysbench.yml \
 		--tags vars,plot
 
 # Help target to show available options
Signature · 1 line
2.50.1
#15 lore raw

PATCH v5 10/12 ansible_cfg: add support to change ansible.cfg file location

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

This adds support to change the Ansible Configuration filename and location via Kconfig.

Ansible checks the ansible.cfg file using the following order [1]:

* ANSIBLE_CONFIG (environment variable if set)
* ansible.cfg (in the current directory)
* ~/.ansible.cfg (in the home directory)
* /etc/ansible/ansible.cfg

In order to set a custom path, export the ANSIBLE_CONFIG [2] that points to the file selected in Kconfig. But only when the Kconfig option is not empty. In such case, let the user handle the ANSIBLE_CONFIG variable.

[1]
https://docs.ansible.com/ansible/latest/reference_appendices/
config.html#the-configuration-file

[2]
https://docs.ansible.com/ansible/latest/reference_appendices/
config.html#envvar-ANSIBLE_CONFIG

In addition, fix verbose mode (V=1) for the ansible-playbook command by removing the extra @.

Remove the file from MAINTAINERS list as it is autogenerated and not in tree.

---
 MAINTAINERS                                |  1 -
 Makefile                                   | 17 ++++++++++-------
 kconfigs/Kconfig.ansible_cfg               | 23 +++++++++++++++++++++++
 playbooks/roles/ansible_cfg/tasks/main.yml |  3 ++-
 4 files changed, 35 insertions(+), 9 deletions(-)
MAINTAINERS +0 -1
index 3059120..d6f578c 100644
@@ -72,7 +72,6 @@ M:	Daniel Gomez <[email protected]>
 L:	[email protected]
 S:	Maintained
 T:	git https://github.com/linux-kdevops/kdevops.git
-F:	ansible.cfg
 F:	kconfigs/Kconfig.ansible_cfg
 F:	playbooks/ansible_cfg.yml
 F:	playbooks/roles/ansible_cfg
Makefile +10 -7
index 2bd3da4..4fc524a 100644
@@ -26,6 +26,10 @@ KDEVOPS_NODES_ROLE_TEMPLATE_DIR :=		$(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/tem
 export KDEVOPS_NODES_TEMPLATE :=
 export KDEVOPS_MRPROPER :=
 
+ifneq ($(strip $(CONFIG_ANSIBLE_CFG_FILE)),)
+ANSIBLE_CFG_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_FILE) | tr --delete '"')
+export ANSIBLE_CONFIG := $(ANSIBLE_CFG_FILE)
+endif
 ANSIBLE_INVENTORY_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_INVENTORY) | tr --delete '"')
 
 KDEVOPS_INSTALL_TARGETS :=
@@ -195,9 +199,8 @@ include scripts/gen-nodes.Makefile
 	make -f scripts/build.Makefile help                             ;\
 	false)
 
-
-ansible.cfg: .config
-	@$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
+$(ANSIBLE_CFG_FILE): .config
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
 		--inventory localhost, \
 		$(KDEVOPS_PLAYBOOKS_DIR)/ansible_cfg.yml \
 		--extra-vars=@./.extra_vars_auto.yaml
@@ -216,7 +219,7 @@ playbooks/secret.yml:
 	@echo "$(CONFIG_KDEVOPS_REG_TWOLINE_REGCODE_VAR): $(CONFIG_KDEVOPS_REG_TWOLINE_REGCODE)" >> $@
 
 ifeq (y,$(CONFIG_KDEVOPS_ENABLE_DISTRO_EXTRA_ADDONS))
-$(KDEVOPS_EXTRA_ADDON_DEST): .config ansible.cfg $(KDEVOPS_EXTRA_ADDON_SOURCE)
+$(KDEVOPS_EXTRA_ADDON_DEST): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_EXTRA_ADDON_SOURCE)
 	$(Q)cp $(KDEVOPS_EXTRA_ADDON_SOURCE) $(KDEVOPS_EXTRA_ADDON_DEST)
 endif
 
@@ -227,13 +230,13 @@ include scripts/bringup.Makefile
 endif
 
 DEFAULT_DEPS += $(ANSIBLE_INVENTORY_FILE)
-$(ANSIBLE_INVENTORY_FILE): .config ansible.cfg $(KDEVOPS_HOSTS_TEMPLATE)
+$(ANSIBLE_INVENTORY_FILE): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_HOSTS_TEMPLATE)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_hosts.yml \
 		--extra-vars=@./extra_vars.yaml
 
 DEFAULT_DEPS += $(KDEVOPS_NODES)
-$(KDEVOPS_NODES) $(KDEVOPS_VAGRANT): .config ansible.cfg $(KDEVOPS_NODES_TEMPLATE)
+$(KDEVOPS_NODES) $(KDEVOPS_VAGRANT): .config $(ANSIBLE_CFG_FILE) $(KDEVOPS_NODES_TEMPLATE)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		$(KDEVOPS_PLAYBOOKS_DIR)/gen_nodes.yml \
 		--extra-vars=@./extra_vars.yaml
@@ -264,7 +267,7 @@ mrproper:
 	$(Q)rm -f $(KDEVOPS_NODES)
 	$(Q)rm -f $(ANSIBLE_CFG_INVENTORY) $(KDEVOPS_MRPROPER)
 	$(Q)rm -f .config .config.old extra_vars.yaml $(KCONFIG_YAMLCFG)
-	$(Q)rm -f ansible.cfg
+	$(Q)rm -f $(ANSIBLE_CFG_FILE)
 	$(Q)rm -f playbooks/secret.yml $(KDEVOPS_EXTRA_ADDON_DEST)
 	$(Q)rm -rf include
 	$(Q)rm -rf guestfs
kconfigs/Kconfig.ansible_cfg +23 -0
index a05c8cb..dbd189f 100644
@@ -18,6 +18,29 @@ config ANSIBLE_CFG_INVENTORY_SET_BY_CLI
 	bool
 	default $(shell, scripts/check-cli-set-var.sh KDEVOPS_HOSTS)
 
+config ANSIBLE_CFG_FILE
+	string "Ansible configuration file"
+	output yaml
+	default "$(TOPDIR_PATH)/ansible.cfg"
+	help
+	  Path and filename to the Ansible configuration file.
+
+	  This option lets you specify the path and filename for the Ansible
+	  configuration file. If the specified file already exists, it will not
+	  be overwritten. Otherwise, kdevops will generate one using the settings
+	  defined in this Kconfig menu.
+
+	  If this option is left undefined or set to an empty string, kdevops
+	  will not generate any configuration file. In that case, Ansible will
+	  fall back to its own search order to locate a config file:
+	    1. The ANSIBLE_CONFIG environment variable (if set)
+	    2. ./ansible.cfg (in the current working directory)
+	    3. ~/.ansible.cfg (in the user's home directory)
+	    4. /etc/ansible/ansible.cfg (system-wide default)
+
+	  For more details, refer to the Ansible documentation:
+	  https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file
+
 menu "Ansible Callback Plugin Configuration"
 choice
 	prompt "Ansible Callback Plugin"
playbooks/roles/ansible_cfg/tasks/main.yml +2 -1
index 83a1659..c2b0db1 100644
@@ -14,7 +14,8 @@
 - name: Generate kdevops ansible.cfg
   ansible.builtin.template:
     src: "ansible.cfg.j2"
-    dest: "{{ topdir_path }}/ansible.cfg"
+    dest: "{{ ansible_cfg_file }}"
+    mode: '0755'
 
 - name: Update ansible.cfg access modification time so make sees it updated
   ansible.builtin.file:
Signature · 1 line
2.50.1
#16 lore raw

PATCH v5 11/12 docs: ansible_cfg: add documentation

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Add documentation file for the Ansible Configuration Module (ansible_cfg).

---
 MAINTAINERS                           |   1 +
 docs/kdevops-ansible-configuration.md | 102 ++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)
MAINTAINERS +1 -0
index d6f578c..87273ca 100644
@@ -72,6 +72,7 @@ M:	Daniel Gomez <[email protected]>
 L:	[email protected]
 S:	Maintained
 T:	git https://github.com/linux-kdevops/kdevops.git
+F:	docs/kdevops-ansible-configuration.md
 F:	kconfigs/Kconfig.ansible_cfg
 F:	playbooks/ansible_cfg.yml
 F:	playbooks/roles/ansible_cfg
docs/kdevops-ansible-configuration.md new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.50.1
#17 lore raw

PATCH v5 12/12 build.Makefile: fix verbosity of clean target

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Fixes verbosity of the clean target. When used with new verbosity, it makes it fail as it tries to print the @ command.

==> [mrproper]
+ @rm -f *.o
/bin/sh: 1: @rm: not found
make[1]: *** [scripts/build.Makefile:7: clean] Error 127
make: *** [Makefile:267: mrproper] Error 2

---
 scripts/build.Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/build.Makefile +1 -1
index 62aaccf..6fe5c11 100644
@@ -4,7 +4,7 @@
 PHONY += clean
 clean: $(clean-subdirs)
 	$(Q)$(MAKE) -C scripts/kconfig/ clean
-	$(Q)@rm -f *.o $(obj-y)
+	$(Q)rm -f *.o $(obj-y)
 
 PHONY += mrproper
 mrproper:
Signature · 1 line
2.50.1
Reviewed-by on the v5 series
#18 lore raw
In reply to Daniel Gomez
Quoted 286 lines · Daniel Gomez

Following Chuck's proposed changes to make task parallelism configurable via the Ansible configuration file [1], and the subsequent cleanup of ansible-playbook calls [2] along with the Python interpreter improvements [3] to better support distros like NixOS through simplified global interpreter configuration [4], I considered applying the same approach to the inventory file. This would further streamline our Ansible wrapper in the kdevops Makefiles.

Why make this change? By specifying the inventory file (typically 'hosts' file in kdevops) directly in ansible.cfg, we eliminate the need for repeated -i/--inventory arguments and gain flexibility in where the inventory file is located. This also supports the broader sandboxing goal discussed in [5]. Moreover, by including localhost in the inventory, we can clean up the Makefile wrapper even further by removing --connection=localhost and -i localhost options, while also enabling workflows to run directly on the controller node (with some extra more modifications).

https://lore.kernel.org/kdevops/[email protected]/

[1]
Increase default task parallelism
https://lore.kernel.org/kdevops/[email protected]/
[2]
[PATCH 2/2] Makefile: Remove "-f 30" command line argument
https://lore.kernel.org/kdevops/[email protected]/

[3]
https://lore.kernel.org/kdevops/[email protected]/

[4]
https://lore.kernel.org/kdevops/kwpt5iizzmryybpg6z3fgs6koak27rjggydfighd42wn7mxqja@2hwvtppppzsk/

[5]
https://lore.kernel.org/kdevops/[email protected]/

This series 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. Also notice delegate_to is needed when the playbook runs and iterates on specific nodes such as baseline and dev but a specific task needs to be handled back to the controller node.

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 'baseline:dev', which means all targets in the inventory file in the baseline and dev groups, matching the 'all' concept in the former configuration 'hosts' file. Except the bootlinux.yml and guestfs.yml playbooks, all playbooks run either on localhost or remote targets (the previous 'all' definition). Therefore, all playbooks have been converted to use 'hosts: baseline:dev'. 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 (baseline:dev). For guestfs.yml, a combination of --limit + delegate_to is needed for the reason explained above: to iterate on the targets (baseline:dev) but delegate certain tags to the controller node with delegate_to.

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:
v1:
https://github.com/linux-kdevops/kdevops/actions/runs/14773869477
v3:
https://github.com/linux-kdevops/kdevops/actions/runs/14846101950
v4:
https://github.com/linux-kdevops/kdevops/actions/runs/16033723055
v5:
https://github.com/linux-kdevops/kdevops/actions/runs/16506085205

---
Changes in v5:
- Rebase on top of main as of 2025-07-24
- Update the new mmtests and stead_state Makefiles accordingly
- Test gitr and nfstest workflows with nfsd enabled
- Test pynfs workflow with iscsi service
- Fix spelling reported by Chuck
- Fix Ansible WARNING when generating ansible.cfg reported by Chuck.
Revert to specify inventory and target. After all, we can't leverage the
inventory in ansible.cfg as it's not generated yet
- Replace hosts field baseline:dev with iscsi in playbooks/iscsi.yml and
do the same for kdc, krb5 and nfsd, smbd playbooks. This also allows to
remove --limit from their ansible-playbook incantations
- Fix duplicate name field in playbooks/nfstest.yml
- Fix workflows that depend on nfsd, iscsi, smbd, kdc, krb5 guests by
introducing a new group "service", and use it for bringup operations and
SSH wait in $KDEVOPS_PROVISIONED_SSH (.provisioned_once_ssh) target.
Reported by Chuck
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- Add trailers (from Luis)
- Rebase on top of main
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Fix LIMIT_HOSTS. When HOSTS="host1" was used, the --limit replacement
did not work anymore because of the quotes where not needed when using
long form arguments
- Fix bootlinux-local limit in linux target.
- Replace all:!localhost with baseline:dev as suggested by Luis. This
allows to include localhost as part of the baseline and/or dev groups
for baremetal workflows
- Allow to configure the ansible.cfg location. This requires to export
the ANSIBLE_CONFIG. This also enables sandboxing
- Fix debug mode when ansible.cfg is created (command was not printed
because of double @)
- Add back KDEVOPS_HOSTS as cli option. KDEVOPS_HOSTS was not part of
the cli before but it was allowed to be overwritten at command line
time. This allows to be explicit and keeps backwards compatibility with
the variable
- Extend ANSIBLE_CFG_FILE help as per Chuck's suggestion
- Move ANSIBLE_CFG_FILE location in Kconfig and place it after
SET_BY_CLI options
- Remove crash_watchdog.py inventory arguments (Reported by Luis)
- Remove inventory arguments from docs, READMEs and remaining Makefiles
- Move ueh_hosts hunk to fix undefined variable in patch "gen_hosts:
templates: add localhost to all hosts"
- Rename CONFIG_KDEVOPS_ANSIBLE_INVENTORY_FILE to CONFIG_ANSIBLE_CFG_INVENTORY
in scripts/lib.sh and kconfigs/Kconfig.ansible_provisioning
- Update cover letter reasoning and commit messages for better clarity
- Link to v2: https://lore.kernel.org/r/[email protected]

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/[email protected]

---
Daniel Gomez (12):
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: add service group to inventory templates
gen_hosts: templates: include localhost in the all group
Makefile: use inventory from ansible.cfg
ansible_cfg: add support to change ansible.cfg file location
docs: ansible_cfg: add documentation build.Makefile: fix verbosity of clean target

 .github/workflows/fstests.yml                      |  16 ++--
 MAINTAINERS                                        |   2 +-
 Makefile                                           |  41 +++++----
 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 +++++++++++++++++++++
 docs/kdevops-terraform.md                          |   2 +-
 kconfigs/Kconfig.ansible_cfg                       |  46 ++++++++++
 kconfigs/Kconfig.ansible_provisioning              |   8 +-
 playbooks/blktests.yml                             |   3 +-
 playbooks/bootlinux.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                              |   6 +-
 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         |   3 +-
 .../roles/ansible_cfg/templates/ansible.cfg.j2     |   1 +
 playbooks/roles/bootlinux/README.md                |  12 +--
 playbooks/roles/common/README.md                   |   2 +-
 playbooks/roles/devconfig/README.md                |   2 +-
 playbooks/roles/gen_hosts/defaults/main.yml        |   1 -
 playbooks/roles/gen_hosts/tasks/main.yml           |  54 +++++------
 playbooks/roles/gen_hosts/templates/blktests.j2    |   1 +
 playbooks/roles/gen_hosts/templates/cxl.j2         |   1 +
 playbooks/roles/gen_hosts/templates/fstests.j2     |  16 ++++
 playbooks/roles/gen_hosts/templates/gitr.j2        |  10 ++
 playbooks/roles/gen_hosts/templates/hosts.j2       |  11 +++
 playbooks/roles/gen_hosts/templates/ltp.j2         |   1 +
 playbooks/roles/gen_hosts/templates/nfstest.j2     |  10 ++
 playbooks/roles/gen_hosts/templates/pynfs.j2       |   8 ++
 playbooks/roles/gen_hosts/templates/selftests.j2   |   1 +
 playbooks/roles/gen_hosts/templates/sysbench.j2    |   1 +
 playbooks/roles/guestfs/tasks/main.yml             |   6 ++
 playbooks/roles/libvirt_user/README.md             |   4 +-
 playbooks/roles/pkg/README.md                      |   2 +-
 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                            |   4 +-
 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/build.Makefile                             |   2 +-
 scripts/devconfig.Makefile                         |   8 +-
 scripts/dynamic-pci-kconfig.Makefile               |   3 +-
 scripts/firstconfig.Makefile                       |   5 +-
 scripts/gen-hosts.Makefile                         |   1 -
 scripts/guestfs.Makefile                           |  19 ++--
 scripts/install-menuconfig-deps.Makefile           |   3 +-
 scripts/iscsi.Makefile                             |   1 -
 scripts/journal-server.Makefile                    |  23 +++--
 scripts/kotd.Makefile                              |  16 ++--
 scripts/krb5.Makefile                              |   2 -
 scripts/ktls.Makefile                              |   1 -
 scripts/lib.sh                                     |   2 +-
 scripts/nfsd.Makefile                              |   1 -
 scripts/provision.Makefile                         |   5 +-
 scripts/rdma.Makefile                              |   2 -
 scripts/smbd.Makefile                              |   1 -
 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                           |  60 +++++++-----
 workflows/ltp/Makefile                             |   8 +-
 workflows/mmtests/Makefile                         |  12 +--
 workflows/nfstest/Makefile                         |   8 +-
 workflows/pynfs/Makefile                           |  12 +--
 workflows/selftests/Makefile                       |  11 ++-
 workflows/steady_state/Makefile                    |   8 +-
 workflows/sysbench/Makefile                        |  12 +--
 115 files changed, 601 insertions(+), 323 deletions(-)
Quoted 9 lines

---
base-commit: df5f66ca52a8dd0794c4c0ea72c1068643a18279
change-id: 20250430-ansible_cfg_inventory-7955944ce8ff

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>
Signature · 1 line
Chuck Lever
Applied
#19 lore raw
In reply to Daniel Gomez
Quoted 9 lines · Daniel Gomez

Following Chuck's proposed changes to make task parallelism configurable via the Ansible configuration file [1], and the subsequent cleanup of ansible-playbook calls [2] along with the Python interpreter improvements [3] to better support distros like NixOS through simplified global interpreter configuration [4], I considered applying the same approach to the inventory file. This would further streamline our Ansible wrapper in the kdevops Makefiles.

[...]

Applied, thanks!

[01/12] playbooks: fix playbook name for all hosts plays

        commit: 118a9d7020892acd86fe67a3f279c88592aaa691
[02/12] playbooks: fix playbook name for localhost plays
        commit: 35f8e3251fdfe54bc9d96a5904999bf99af3083d
[03/12] Makefile: use long form of limit argument for clarity
        commit: 4b451118401dbdc8889417a08930861641dc016c
[04/12] Makefile: print target when debug
        commit: 3c623312d4587f940bf9f7b8c60d739257a91af8
[05/12] .github/workflows/fstests.yml: enable make verbosity
        commit: 180318a1f119f5f6315caae8e12491741698c1b7
[06/12] ansible_cfg: add inventory support
        commit: c8ceb41299125696adc413b6fbfcd925ce042bd3
[07/12] gen_hosts: add service group to inventory templates
        commit: 7258480719e7ea127a14aacb7d7b9983b8347864
[08/12] gen_hosts: templates: include localhost in the all group
        commit: 1cf0800c9ffced98da393e5d2b1594302d23eb78
[09/12] Makefile: use inventory from ansible.cfg
        commit: 0987c30034c99511421c60581dd4b688549b532e
[10/12] ansible_cfg: add support to change ansible.cfg file location
        commit: f6e1769b9d85e3fc21c8ea49360612608b7e98f1
[11/12] docs: ansible_cfg: add documentation
        commit: 8a447b1eef67ba02abfa0104df1c56361273bb3b
[12/12] build.Makefile: fix verbosity of clean target
        commit: ee694caf05a590bdc4f63f823d309e4fcf1a9a40

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>