Fix inconsistent ansible-playbook patterns across kdevops
cover Fix inconsistent ansible-playbook patterns across kdevops
This series fixes inconsistent ansible-playbook invocation patterns that were introduced during recent A/B testing development work. The changes standardize how kdevops uses Ansible by properly leveraging ansible.cfg configuration and playbook host declarations instead of explicit CLI overrides.
Key improvements:
* Remove invalid custom host groups (ai, minio) and use standard kdevops groups
* Eliminate redundant -i hosts and --inventory CLI arguments
* Remove unnecessary connection: local and -f fork parameters
* Fix documentation examples to show correct patterns
The result is cleaner, more maintainable ansible invocations that follow established kdevops architectural patterns.
Sending this for review, specifically the terraform part (last patch).
---
Daniel Gomez (4):
workflows: linux: remove explicit inventory in ansible wrappers
workflows: fix inconsistent ansible-playbook patterns and invalid host groups
docs: remove deprecated -i hosts pattern from CLAUDE.md example
terraform: remove redundant ansible inventory and connection overrides
CLAUDE.md | 2 +- docs/reboot-limit.md | 2 +- playbooks/ai_benchmark.yml | 2 +- playbooks/ai_destroy.yml | 2 +- playbooks/ai_install.yml | 2 +- playbooks/ai_results.yml | 2 +- playbooks/ai_setup.yml | 2 +- playbooks/ai_tests.yml | 6 +++--- playbooks/ai_uninstall.yml | 2 +- playbooks/gen_tfvars.yml | 1 - playbooks/minio.yml | 10 +++++----- playbooks/terraform.yml | 1 - scripts/terraform.Makefile | 7 +------ workflows/ai/Makefile | 14 -------------- workflows/linux/Makefile | 19 +++++++++++-------- workflows/minio/Makefile | 8 ++++---- 16 files changed, 32 insertions(+), 50 deletions(-)
---
base-commit: e46620a6a9518281e670319bb8e3fb109eba70f2
change-id: 20250917-fix-groups-d59935f3ff3c
Best regards,
Signature · 1 line
Daniel Gomez <[email protected]>
PATCH 1/4 workflows: linux: remove explicit inventory in ansible wrappers
From: Daniel Gomez <[email protected]>
The A/B testing implementation introduced back the --inventory argument for the ansible-playbook invocation patterns. Three targets (linux, linux-baseline, linux-dev) were using '-i hosts' instead of leveraging the ansible.cfg inventory key + the established '--limit' or hosts:
YAML field.
Also, for bootlinux playbook case, this caused the playbook to run on localhost, leading to failures when localhost doesn't have the required virtualization setup:
- virtio devices (/dev/disk/by-id/virtio-kdevops0)
- 9p kernel modules and filesystem support
- target directory structure (/data/linux-stable)
- etc.
--- workflows/linux/Makefile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
workflows/linux/Makefile +11 -8
@@ -101,8 +101,9 @@ ifeq (y,$(CONFIG_BOOTLINUX_AB_DIFFERENT_REF)) linux: linux-baseline linux-dev else linux: $(KDEVOPS_NODES) - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ - hosts $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + --limit 'baseline:dev' \ + $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) endif else
@@ -116,9 +117,10 @@ endif PHONY += linux-baseline ifeq (y,$(CONFIG_KDEVOPS_BASELINE_AND_DEV)) linux-baseline: $(KDEVOPS_NODES) - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ - hosts $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ - --extra-vars="$(BOOTLINUX_ARGS)" --limit baseline + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + --limit baseline \ + $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ + --extra-vars="$(BOOTLINUX_ARGS)" else linux-baseline: @echo "linux-baseline requires KDEVOPS_BASELINE_AND_DEV=y"
@@ -128,9 +130,10 @@ endif PHONY += linux-dev ifeq (y,$(CONFIG_KDEVOPS_BASELINE_AND_DEV)) linux-dev: $(KDEVOPS_NODES) - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ - hosts $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ - --extra-vars="$(BOOTLINUX_ARGS)" --limit dev + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + --limit dev \ + $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ + --extra-vars="$(BOOTLINUX_ARGS)" else linux-dev: @echo "linux-dev requires KDEVOPS_BASELINE_AND_DEV=y"
Signature · 1 line
2.50.1
PATCH 2/4 workflows: fix inconsistent ansible-playbook patterns and invalid host groups
In reply to Daniel GomezFrom: Daniel Gomez <[email protected]>
Multiple issues were introduced in commit 7f25db722:
1. Workflow Makefiles using "-i hosts" explicitly instead of relying on ansible.cfg inventory configuration
2. AI and minio workflows incorrectly using custom host groups "ai" and "minio" instead of standard kdevops host groups
3. Redundant "-f" fork parameters when ansible.cfg already configures forks
The only valid host groups in kdevops are: all, baseline, dev, and service. Custom workflow-specific host groups violate the established architecture.
This removes invalid groups, the -i/--inventory arguments, -f/--forks parameters + leverages the ansible.cfg configuration.
--- playbooks/ai_benchmark.yml | 2 +- playbooks/ai_destroy.yml | 2 +- playbooks/ai_install.yml | 2 +- playbooks/ai_results.yml | 2 +- playbooks/ai_setup.yml | 2 +- playbooks/ai_tests.yml | 6 +++--- playbooks/ai_uninstall.yml | 2 +- playbooks/minio.yml | 10 +++++----- workflows/ai/Makefile | 14 -------------- workflows/minio/Makefile | 8 ++++---- 10 files changed, 18 insertions(+), 32 deletions(-)
playbooks/ai_benchmark.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Run Milvus Vector Database Benchmarks - hosts: ai + hosts: baseline:dev vars: ai_vector_db_milvus_benchmark_enable: true roles:
playbooks/ai_destroy.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Destroy Milvus Vector Database - hosts: ai + hosts: baseline:dev become: true tasks: - name: Stop Milvus containers
playbooks/ai_install.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Install Milvus Vector Database - hosts: ai + hosts: baseline:dev become: true become_user: root roles:
playbooks/ai_results.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Collect and analyze AI benchmark results - hosts: ai + hosts: baseline:dev roles: - ai_collect_results tags: ['ai', 'ai_results']
playbooks/ai_setup.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Setup AI benchmark environment - hosts: ai + hosts: baseline:dev roles: - ai_setup tags: ['ai', 'ai_setup']
playbooks/ai_tests.yml +3 -3
@@ -3,7 +3,7 @@ # This ensures AI infrastructure is setup before running benchmarks - name: AI Tests - Ensure Milvus is installed - hosts: ai + hosts: baseline:dev become: true become_user: root roles:
@@ -12,7 +12,7 @@ tags: ['ai', 'milvus', 'setup'] - name: AI Tests - Vector Database Benchmarks - hosts: ai + hosts: baseline:dev become: true vars: # Skip infrastructure setup when running tests
@@ -23,7 +23,7 @@ tags: ['ai', 'benchmark'] - name: AI Tests - Results Collection - hosts: ai + hosts: baseline:dev become: true roles: - role: ai_collect_results
playbooks/ai_uninstall.yml +1 -1
@@ -1,6 +1,6 @@ --- - name: Uninstall AI benchmark components - hosts: ai + hosts: baseline:dev roles: - ai_uninstall tags: ['ai', 'ai_uninstall']
playbooks/minio.yml +5 -5
@@ -2,7 +2,7 @@ # MinIO S3 Storage Benchmarking Playbook - name: Install MinIO and setup - hosts: minio + hosts: baseline:dev become: true become_user: root tags: ['minio_install']
@@ -21,7 +21,7 @@ minio_docker_network: "{{ minio_docker_network_name }}" - name: Run MinIO Warp benchmarks - hosts: minio + hosts: baseline:dev become: true become_user: root tags: ['minio_warp']
@@ -29,7 +29,7 @@ - role: minio_warp_run - name: Uninstall MinIO - hosts: minio + hosts: baseline:dev become: true become_user: root tags: ['minio_uninstall']
@@ -37,7 +37,7 @@ - role: minio_uninstall - name: Destroy MinIO and cleanup - hosts: minio + hosts: baseline:dev become: true become_user: root tags: ['minio_destroy']
@@ -45,7 +45,7 @@ - role: minio_destroy - name: Analyze MinIO results - hosts: minio + hosts: baseline:dev become: true become_user: root tags: ['minio_results']
workflows/ai/Makefile +0 -14
@@ -31,9 +31,7 @@ export AI_ARGS_SEPARATED := $(subst $(space),$(comma),$(AI_ARGS)) # Main AI workflow targets ai: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai.yml \ - -f 10 \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \ $(LIMIT_HOSTS)
@@ -47,9 +45,7 @@ ai-dev: # AI Testing/Benchmark targets ai-tests: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_tests.yml \ - -f 10 \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \ $(LIMIT_HOSTS)
@@ -58,9 +54,7 @@ ai-tests: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) ai-tests-baseline: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ -l baseline \ - -i hosts \ playbooks/ai_tests.yml \ - -f 10 \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" $(Q)$(MAKE) ai-results-baseline
@@ -68,9 +62,7 @@ ai-tests-baseline: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) ai-tests-dev: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ -l dev \ - -i hosts \ playbooks/ai_tests.yml \ - -f 10 \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" $(Q)$(MAKE) ai-results-dev
@@ -78,9 +70,7 @@ ai-tests-dev: $(KDEVOPS_NODES) $(ANSIBLE_INVENTORY_FILE) # Target to only run results analysis and graph generation ai-tests-results: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_tests.yml \ - -f 10 \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \ --tags="results" \
@@ -89,7 +79,6 @@ ai-tests-results: # Results collection targets ai-results: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_results.yml \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \
@@ -103,7 +92,6 @@ ai-results-dev: ai-setup: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_setup.yml \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \
@@ -111,7 +99,6 @@ ai-setup: ai-uninstall: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_uninstall.yml \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \
@@ -119,7 +106,6 @@ ai-uninstall: ai-destroy: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -i hosts \ playbooks/ai_destroy.yml \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --extra-vars="$(AI_ARGS) $(AI_MANUAL_ARGS)" \
workflows/minio/Makefile +4 -4
@@ -14,25 +14,25 @@ $(MINIO_DATA_TARGET): $(ANSIBLE_INVENTORY_FILE) $(MINIO_DATA_TARGET_INSTALL): $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts $(MINIO_PLAYBOOK) \ + $(MINIO_PLAYBOOK) \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --tags vars,minio_install $(MINIO_DATA_TARGET_UNINSTALL): $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts $(MINIO_PLAYBOOK) \ + $(MINIO_PLAYBOOK) \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --tags vars,minio_uninstall $(MINIO_DATA_TARGET_DESTROY): $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts $(MINIO_PLAYBOOK) \ + $(MINIO_PLAYBOOK) \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --tags vars,minio_destroy $(MINIO_DATA_TARGET_RUN): $(ANSIBLE_INVENTORY_FILE) $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - -f 30 -i hosts $(MINIO_PLAYBOOK) \ + $(MINIO_PLAYBOOK) \ --extra-vars=@$(KDEVOPS_EXTRA_VARS) \ --tags vars,minio_warp
Signature · 1 line
2.50.1
PATCH 3/4 docs: remove deprecated -i hosts pattern from CLAUDE.md example
In reply to Daniel GomezFrom: Daniel Gomez <[email protected]>
The example ansible command was using the deprecated explicit inventory pattern "-i hosts" instead of relying on ansible.cfg configuration.
This updates the documentation to show the correct pattern that leverages the configured inventory file.
--- CLAUDE.md | 2 +- docs/reboot-limit.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
CLAUDE.md +1 -1
@@ -30,7 +30,7 @@ Device Under Test (DUT) systems. - **ALWAYS** verify that test systems are running and accessible before analysis ### Valid approaches: -- ✅ Execute real tests: `ansible -i hosts all -m shell -a "fio --output-format=json ..."` +- ✅ Execute real tests: `ansible all -m shell -a "fio --output-format=json ..."` - ✅ Collect actual JSON output from running VMs - ✅ Parse and analyze real performance data from live systems - ✅ Generate graphs and reports from actual test execution results
docs/reboot-limit.md +1 -1
@@ -176,7 +176,7 @@ Enable verbose output for troubleshooting: make reboot-limit-baseline AV=3 # Check individual node status -ansible -i hosts all -m shell -a "cat /data/reboot-limit/*/reboot-count.txt" +ansible baseline:dev:service -m shell -a "cat /data/reboot-limit/*/reboot-count.txt" ``` ## Interpreting Performance Data
Signature · 1 line
2.50.1
PATCH 4/4 terraform: remove redundant ansible inventory and connection overrides
In reply to Daniel GomezFrom: Daniel Gomez <[email protected]>
Remove unnecessary --inventory localhost, and connection: local parameters and embrace the ansible.cfg and playbook hosts fields.
--- playbooks/gen_tfvars.yml | 1 - playbooks/terraform.yml | 1 - scripts/terraform.Makefile | 7 +------ 3 files changed, 1 insertion(+), 8 deletions(-)
playbooks/gen_tfvars.yml +0 -1
@@ -1,6 +1,5 @@ --- - name: Generate Terraform variables file (terraform/terraform.tfvars) - connection: local hosts: localhost roles: - role: gen_tfvars
playbooks/terraform.yml +0 -1
@@ -1,6 +1,5 @@ --- - name: Manage infrastructure lifecycle and SSH access with Terraform - connection: local hosts: localhost gather_facts: false roles:
scripts/terraform.Makefile +1 -6
@@ -203,23 +203,20 @@ endif bringup_terraform: lambdalabs-ssh-check $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - --inventory localhost, \ playbooks/terraform.yml --tags bringup \ --extra-vars=@./extra_vars.yaml $(KDEVOPS_PROVISIONED_SSH): $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - --inventory localhost, \ playbooks/terraform.yml --tags ssh \ --extra-vars=@./extra_vars.yaml $(Q)ansible $(ANSIBLE_VERBOSE) \ - -i hosts baseline:dev:service \ + baseline:dev:service \ -m wait_for_connection $(Q)touch $(KDEVOPS_PROVISIONED_SSH) status_terraform: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - --inventory localhost, \ playbooks/terraform.yml --tags status \ --extra-vars=@./extra_vars.yaml
@@ -227,13 +224,11 @@ destroy_terraform: destroy_terraform_base lambdalabs-ssh-clean-after destroy_terraform_base: $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - --inventory localhost, \ 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) \ - --inventory localhost, \ $(KDEVOPS_PLAYBOOKS_DIR)/gen_tfvars.yml \ --extra-vars=@./extra_vars.yaml
Signature · 1 line
2.50.1
Luis Chamberlain
AppliedQuoted 13 lines · Daniel Gomez
This series fixes inconsistent ansible-playbook invocation patterns that were introduced during recent A/B testing development work. The changes standardize how kdevops uses Ansible by properly leveraging ansible.cfg configuration and playbook host declarations instead of explicit CLI overrides.
Key improvements:
* Remove invalid custom host groups (ai, minio) and use standard kdevops groups
* Eliminate redundant -i hosts and --inventory CLI arguments
* Remove unnecessary connection: local and -f fork parameters
* Fix documentation examples to show correct patterns
Quoted 6 lines
The result is cleaner, more maintainable ansible invocations that follow established kdevops architectural patterns.
Sending this for review, specifically the terraform part (last patch).
Signed-off-by Daniel Gomez <[email protected]>
Thanks, applied and pushed!
Luis