From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CC00288CA3 for ; Fri, 29 Aug 2025 10:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756465009; cv=none; b=BajWu1HB9f3crxdXu0/J+9pZlw7pVkRLQdJdN2NMbfPQyUnlC8xZ87zqzujh+17P40MDgFShisv7SbPSBVZExUsE4+ivKHcYMVCZ9zeZvoWUbOhY+e0QkIW/isCOSi22z5yL/2tLRSABR6u34noszkQu1z9i9wJ/5Te/VdSCzC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756465009; c=relaxed/simple; bh=drEL0Q9FU3LoHL0vcCaUu+ynR00NNaox0JLN4NSTVmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nEepSRPoPa9hNUMrUtLzsMesNXlseiPf0FrcjZ3CSfy4lj68r6q7olS7PF2tEmJALw6STpno9ZZ1yL51oiTw/8Ow986WGaErdWKDlnEd1wqZwzPumSNRq+84/RlfFyd7bXp7kvT5tsZnxp+k+drIVVUdY7NXzWcvTuWqIzUXf7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=cA0Eu4eu; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cA0Eu4eu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=plnC5DwIcfwaHFVDkZxyhtKQy4Usm1jTLFD3peehJV4=; b=cA0Eu4euXLXHoN3LWwOGdbvAm3 DAkVW1x9psIuoz+CnjLsYUpGD5SwDuZugQ3C1VW6X3pfRpUKpXZIIYE+rCisK3a6RWiJnQvRrteZS Rpo6XhXY8E9rQj02WvbDxOKyx7Yq/ErAw04WHxC8H6+fgc4n9JH6Xl/oEZwY2oDB+c1MO5g094zdz wA5lXZ42VKKuW3IHeh8LxrkkpUv9n11lMSWG+b7szEUQ8WTiV7mGhRXuakw69ty880CBsU6veAr/X mxFY68ruiumtf7D1g0zO5Pagnf42ZfH8RxvisXTd+xt+eljorcFWHoyPMjV20krvvsZKvC1FY7KWx c3nWXQ5w==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1urwmk-00000005PLm-3EK6; Fri, 29 Aug 2025 10:56:46 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH 2/2] declared_hosts: add support for pre-existing infrastructure Date: Fri, 29 Aug 2025 03:56:45 -0700 Message-ID: <20250829105645.1289069-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250829105645.1289069-1-mcgrof@kernel.org> References: <20250829105645.1289069-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain This adds support for using pre-existing infrastructure (bare metal servers, pre-provisioned VMs) that already have SSH access configured. This is useful for environments where kdevops bringup/teardown is not desired or possible. Key features: - New DECLARE_HOSTS CLI parameter to specify existing hosts - Automatic detection of CLI override to enable declared hosts mode - SKIP_BRINGUP is automatically selected when using declared hosts - Hosts can be specified as space or comma-separated list - For A/B testing workflows, odd-numbered hosts become baseline nodes and even-numbered hosts become dev nodes - New Kconfig.declared_hosts for configuration options - New declared-hosts.j2 template for generating inventory Usage: make defconfig-xfs_reflink_4k DECLARE_HOSTS='server1 server2 server3' make # Will skip bringup and use the declared hosts The implementation assumes SSH access is already configured in the user's ~/.ssh/config or via SSH keys. No SSH configuration is generated by kdevops when using declared hosts. This feature integrates cleanly with the refactored template system, using the same hosts.j2 entry point with a dedicated declared-hosts.j2 template for this mode. Generated-by: Claude AI Signed-off-by: Luis Chamberlain --- Makefile | 7 + kconfigs/Kconfig.bringup | 7 + kconfigs/Kconfig.declared_hosts | 65 ++++++ playbooks/roles/devconfig/defaults/main.yml | 1 + playbooks/roles/devconfig/tasks/main.yml | 60 +++++ playbooks/roles/gen_hosts/defaults/main.yml | 1 + playbooks/roles/gen_hosts/tasks/main.yml | 40 +++- .../templates/workflows/declared-hosts.j2 | 219 ++++++++++++++++++ playbooks/roles/gen_nodes/tasks/main.yml | 5 + 9 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 kconfigs/Kconfig.declared_hosts create mode 100644 playbooks/roles/gen_hosts/templates/workflows/declared-hosts.j2 diff --git a/Makefile b/Makefile index 83c67340..fcb626ae 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,13 @@ export KDEVOPS_NODES := export PYTHONUNBUFFERED=1 export TOPDIR=./ export TOPDIR_PATH = $(shell readlink -f $(TOPDIR)) + +# Export CLI override variables for Kconfig to detect them +# Note: We accept DECLARE_HOSTS but export as DECLARED_HOSTS for consistency +ifdef DECLARE_HOSTS +export DECLARED_HOSTS := $(DECLARE_HOSTS) +endif + include scripts/refs.Makefile KDEVOPS_NODES_ROLE_TEMPLATE_DIR := $(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/templates diff --git a/kconfigs/Kconfig.bringup b/kconfigs/Kconfig.bringup index 8caf07be..f7f9735a 100644 --- a/kconfigs/Kconfig.bringup +++ b/kconfigs/Kconfig.bringup @@ -9,8 +9,14 @@ config KDEVOPS_ENABLE_NIXOS bool output yaml +# CLI override detection for DECLARED_HOSTS which should enable SKIP_BRINGUP +config SKIP_BRINGUP_SET_BY_CLI + bool + default $(shell, scripts/check-cli-set-var.sh DECLARED_HOSTS) + choice prompt "Node bring up method" + default SKIP_BRINGUP if SKIP_BRINGUP_SET_BY_CLI default GUESTFS config GUESTFS @@ -80,6 +86,7 @@ config LIBVIRT source "kconfigs/Kconfig.guestfs" source "kconfigs/Kconfig.nixos" source "terraform/Kconfig" +source "kconfigs/Kconfig.declared_hosts" if LIBVIRT source "kconfigs/Kconfig.libvirt" endif diff --git a/kconfigs/Kconfig.declared_hosts b/kconfigs/Kconfig.declared_hosts new file mode 100644 index 00000000..56b56845 --- /dev/null +++ b/kconfigs/Kconfig.declared_hosts @@ -0,0 +1,65 @@ +# Configuration for declared hosts that skip bringup process + +# CLI override support for DECLARED_HOSTS +config KDEVOPS_DECLARED_HOSTS_SET_BY_CLI + bool + output yaml + default $(shell, scripts/check-cli-set-var.sh DECLARED_HOSTS) + +config KDEVOPS_USE_DECLARED_HOSTS + bool "Use declared hosts (skip bringup process)" + depends on SKIP_BRINGUP || KDEVOPS_DECLARED_HOSTS_SET_BY_CLI + select WORKFLOW_INFER_USER_AND_GROUP + output yaml + default y if SKIP_BRINGUP + default y if KDEVOPS_DECLARED_HOSTS_SET_BY_CLI + help + Enable this option to use pre-existing hosts that you have already + configured with SSH access. This is useful for: + + * Bare metal systems + * Pre-provisioned VMs or cloud instances + * Systems managed by other infrastructure tools + + When this option is enabled: + - SSH keys will not be generated (assumes you already have access) + - Bringup and teardown operations will be skipped + - User and group settings will be inferred from the target hosts + - You must provide the list of hosts in KDEVOPS_DECLARED_HOSTS + + This option automatically: + - Selects WORKFLOW_INFER_USER_AND_GROUP to detect the correct + user and group on the target systems + - Assumes SSH access is already configured + +if KDEVOPS_USE_DECLARED_HOSTS + +config KDEVOPS_DECLARED_HOSTS + string "List of declared hosts (space or comma separated)" + output yaml + default $(shell, ./scripts/append-makefile-vars.sh $(DECLARED_HOSTS)) if KDEVOPS_DECLARED_HOSTS_SET_BY_CLI + default "" + help + Provide a space or comma-separated list of hostnames or IP addresses + that are already accessible via SSH. + + Examples: + - Single host: "server1.example.com" + - Multiple hosts: "server1.example.com server2.example.com" + - IP addresses: "192.168.1.10 192.168.1.11" + - Mixed: "server1.example.com 10.0.0.5 server2.local" + + For A/B testing workflows with baseline/dev configurations, you can + provide an even number of hosts. The odd-numbered hosts will be used + as baseline nodes and even-numbered hosts as dev nodes. + + Requirements: + - SSH access must already be configured for these hosts + - The user running kdevops must have passwordless SSH access + - The hosts should have the required dependencies installed + + Note: kdevops assumes you have already configured SSH access to these + hosts in your ~/.ssh/config or have appropriate SSH keys set up. + Ansible will use your existing SSH configuration to connect. + +endif # KDEVOPS_USE_DECLARED_HOSTS diff --git a/playbooks/roles/devconfig/defaults/main.yml b/playbooks/roles/devconfig/defaults/main.yml index 98dce312..62e72ffa 100644 --- a/playbooks/roles/devconfig/defaults/main.yml +++ b/playbooks/roles/devconfig/defaults/main.yml @@ -57,3 +57,4 @@ kdevops_enable_guestfs: false guestfs_copy_sources_from_host_to_guest: false distro_debian_has_hop1_sources: false unattended_upgrades_installed: false +kdevops_use_declared_hosts: false diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml index fccd1fcf..e93c6078 100644 --- a/playbooks/roles/devconfig/tasks/main.yml +++ b/playbooks/roles/devconfig/tasks/main.yml @@ -17,6 +17,66 @@ ansible.builtin.setup: tags: always +- name: Determine the actual user's home directory when using inferred user + block: + - name: Get the current username + ansible.builtin.command: whoami + register: current_user + changed_when: false + + - name: Get home directory for the current user + ansible.builtin.shell: | + # When workflow_infer_user_and_group is enabled, we need to use the actual SSH user + # not the hardcoded 'kdevops' user from group_vars/all + actual_user="{{ current_user.stdout }}" + if [ -n "$actual_user" ]; then + getent passwd "$actual_user" | cut -d: -f6 + else + echo "/root" + fi + register: inferred_home_dir + changed_when: false + + - name: Set data_user and data_home_dir based on inferred user + set_fact: + data_user: "{{ current_user.stdout }}" + data_home_dir: "{{ inferred_home_dir.stdout }}" + dev_gitconfig_dest: "{{ inferred_home_dir.stdout }}/.gitconfig" + dev_bash_config: "{{ inferred_home_dir.stdout }}/.bashrc" + dev_bash_config_hacks_dest: "{{ inferred_home_dir.stdout }}/.{{ dev_bash_config_hacks_name }}" + when: workflow_infer_user_and_group | default(false) | bool + +# Also handle the case when workflow_infer_user_and_group is false but we're using declared hosts +# In this case, we should still use the SSH user's actual home directory +- name: Check if using declared hosts without infer setting + block: + - name: Get the current username for declared hosts + ansible.builtin.command: whoami + register: current_user_declared + changed_when: false + + - name: Get home directory for declared hosts user + ansible.builtin.shell: | + actual_user="{{ current_user_declared.stdout }}" + if [ -n "$actual_user" ]; then + getent passwd "$actual_user" | cut -d: -f6 + else + echo "/root" + fi + register: declared_home_dir + changed_when: false + + - name: Override data paths for declared hosts + set_fact: + data_user: "{{ current_user_declared.stdout }}" + data_home_dir: "{{ declared_home_dir.stdout }}" + dev_gitconfig_dest: "{{ declared_home_dir.stdout }}/.gitconfig" + dev_bash_config: "{{ declared_home_dir.stdout }}/.bashrc" + dev_bash_config_hacks_dest: "{{ declared_home_dir.stdout }}/.{{ dev_bash_config_hacks_name }}" + when: + - kdevops_use_declared_hosts + - not (workflow_infer_user_and_group | default(false) | bool) + # Update /etc/hostname first so the change gets picked up by the reboot # that occurs during the distro-specific tasks diff --git a/playbooks/roles/gen_hosts/defaults/main.yml b/playbooks/roles/gen_hosts/defaults/main.yml index 4a7515f9..027cbe44 100644 --- a/playbooks/roles/gen_hosts/defaults/main.yml +++ b/playbooks/roles/gen_hosts/defaults/main.yml @@ -20,6 +20,7 @@ kdevops_workflows_dedicated_workflow: false kdevops_workflow_enable_fstests: false kdevops_workflow_enable_blktests: false kdevops_workflow_enable_selftests: false +kdevops_use_declared_hosts: false kdevops_workflow_enable_cxl: false kdevops_workflow_enable_pynfs: false diff --git a/playbooks/roles/gen_hosts/tasks/main.yml b/playbooks/roles/gen_hosts/tasks/main.yml index fb63629a..b475e2b0 100644 --- a/playbooks/roles/gen_hosts/tasks/main.yml +++ b/playbooks/roles/gen_hosts/tasks/main.yml @@ -10,6 +10,7 @@ skip: true tags: vars + - name: Get our user ansible.builtin.command: "whoami" register: my_user @@ -39,6 +40,21 @@ path: "{{ kdevops_hosts_template_full_path }}" register: ansible_hosts_template +- name: Generate the Ansible hosts file for declared hosts configuration + tags: ['hosts'] + ansible.builtin.template: + src: "{{ kdevops_hosts_template }}" + dest: "{{ ansible_cfg_inventory }}" + force: true + trim_blocks: True + lstrip_blocks: True + mode: '0644' + when: + - kdevops_use_declared_hosts + - kdevops_declared_hosts is defined + - kdevops_declared_hosts|length > 0 + - ansible_hosts_template.stat.exists + - name: Set fstests config file variable for {{ fstests_fstyp }} ansible.builtin.set_fact: is_fstests: true @@ -67,6 +83,7 @@ when: - bootlinux_builder - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file tags: ["hosts"] @@ -80,6 +97,7 @@ - not kdevops_workflows_dedicated_workflow - ansible_hosts_template.stat.exists - not kdevops_enable_nixos|default(false)|bool + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file for NixOS tags: ['hosts'] @@ -93,6 +111,7 @@ - not kdevops_workflows_dedicated_workflow - ansible_hosts_template.stat.exists - kdevops_enable_nixos|default(false)|bool + - not kdevops_use_declared_hosts - name: Update Ansible inventory access modification time so make sees it updated ansible.builtin.file: @@ -112,6 +131,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_cxl - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file for dedicated pynfs work tags: ["hosts"] @@ -125,6 +145,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_pynfs - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file for dedicated gitr workflow tags: ["hosts"] @@ -140,6 +161,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_gitr - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate an Ansible inventory file for a dedicated ltp workflow tags: ["hosts"] @@ -155,6 +177,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_ltp - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file for dedicated nfstest workflow tags: ["hosts"] @@ -170,6 +193,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_nfstest - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Set empty enabled test types list for fstests tags: ["hosts"] @@ -178,6 +202,7 @@ when: - is_fstests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Check which fstests test types are enabled register: fstests_enabled_test_types_reg @@ -202,6 +227,7 @@ when: - is_fstests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Now expand the list of enabled fstests for valid configuration sections tags: ["hosts"] @@ -213,6 +239,7 @@ when: - is_fstests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - item.changed - name: Generate the Ansible inventory file for a dedicated fstests setup @@ -233,6 +260,7 @@ when: - is_fstests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Infer enabled blktests test section types ansible.builtin.set_fact: @@ -247,6 +275,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_blktests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Debug inferring block test types ansible.builtin.debug: @@ -269,6 +298,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_blktests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Infer enabled selftests test section types ansible.builtin.set_fact: @@ -283,6 +313,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_selftests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible inventory file for a dedicated selftests setup tags: ["hosts"] @@ -296,6 +327,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_selftests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Collect dynamically supported filesystems vars: @@ -338,6 +370,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_sysbench - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible hosts file for a dedicated fio-tests setup @@ -354,6 +387,7 @@ - kdevops_workflow_enable_fio_tests - ansible_hosts_template.stat.exists - not kdevops_enable_nixos|default(false)|bool + - not kdevops_use_declared_hosts - name: Infer enabled mmtests test types @@ -369,6 +403,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_mmtests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible hosts file for a dedicated mmtests setup tags: ["hosts"] @@ -382,6 +417,7 @@ - kdevops_workflows_dedicated_workflow - kdevops_workflow_enable_mmtests - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Generate the Ansible hosts file for a dedicated reboot-limit setup tags: ["hosts"] @@ -395,6 +431,7 @@ - kdevops_workflows_dedicated_workflow - workflows_reboot_limit - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Load AI nodes configuration for multi-filesystem setup include_vars: @@ -426,8 +463,9 @@ mode: '0644' when: - kdevops_workflows_dedicated_workflow - - kdevops_workflow_enable_ai + - kdevops_workflow_enable_ai|default(false)|bool - ansible_hosts_template.stat.exists + - not kdevops_use_declared_hosts - name: Verify if final host file exists ansible.builtin.stat: diff --git a/playbooks/roles/gen_hosts/templates/workflows/declared-hosts.j2 b/playbooks/roles/gen_hosts/templates/workflows/declared-hosts.j2 new file mode 100644 index 00000000..61b51885 --- /dev/null +++ b/playbooks/roles/gen_hosts/templates/workflows/declared-hosts.j2 @@ -0,0 +1,219 @@ +{# Template for declared hosts that skip bringup process #} +{# This template is used when users have pre-existing infrastructure like: + - Bare metal servers + - Pre-provisioned VMs + - Cloud instances managed outside of kdevops + - Any hosts with existing SSH access + + The hosts are provided via kdevops_declared_hosts variable which contains + a list of hostnames/IPs that are already accessible via SSH. +#} +{# Parse declared hosts - handle both string and list formats #} +{% if kdevops_declared_hosts is string %} +{% set parsed_hosts = kdevops_declared_hosts | regex_replace(',', ' ') | split() %} +{% elif kdevops_declared_hosts is iterable and kdevops_declared_hosts is not string %} +{% set parsed_hosts = kdevops_declared_hosts %} +{% else %} +{% set parsed_hosts = [kdevops_declared_hosts] %} +{% endif %} +[all] +localhost ansible_connection=local +{# Loop through parsed hosts #} +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[all:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% if kdevops_workflows_dedicated_workflow %} +{# For workflows, organize hosts into baseline/dev groups for A/B testing #} +{% if kdevops_baseline_and_dev %} +[baseline] +{# Odd-numbered hosts become baseline nodes #} +{% for host in parsed_hosts %} +{% if loop.index is odd %} +{{ host }} +{% endif %} +{% endfor %} + +[baseline:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +[dev] +{# Even-numbered hosts become dev nodes #} +{% for host in parsed_hosts %} +{% if loop.index is even %} +{{ host }} +{% endif %} +{% endfor %} + +[dev:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% else %} +{# Without A/B testing, all hosts are baseline #} +[baseline] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[baseline:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %} + +{# Add workflow-specific groups based on enabled workflow #} +{% if workflows_reboot_limit %} +[reboot-limit] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[reboot-limit:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_fio_tests %} +[fio_tests] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[fio_tests:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_fstests %} +[fstests] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[fstests:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{# Add per-section groups if needed #} +{% for section in sections|default([]) %} +[fstests_{{ section | replace('-', '_') }}] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[fstests_{{ section | replace('-', '_') }}:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endfor %} + +{% elif kdevops_workflow_enable_blktests %} +[blktests] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[blktests:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_selftests %} +[selftests] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[selftests:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_mmtests %} +[mmtests] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[mmtests:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_sysbench %} +[sysbench] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[sysbench:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_ai|default(false)|bool %} +[ai] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[ai:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_minio|default(false)|bool %} +[minio] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[minio:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_cxl %} +[cxl] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[cxl:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_pynfs %} +[pynfs] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[pynfs:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_gitr %} +[gitr] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[gitr:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_ltp %} +[ltp] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[ltp:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" + +{% elif kdevops_workflow_enable_nfstest %} +[nfstest] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[nfstest:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %} + +{% else %} +{# Non-workflow setup - just use baseline group #} +[baseline] +{% for host in parsed_hosts %} +{{ host }} +{% endfor %} + +[baseline:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" +{% endif %} + +[service] +{# Service nodes are typically not needed for declared hosts #} + +[service:vars] +ansible_python_interpreter = "{{ kdevops_python_interpreter }}" diff --git a/playbooks/roles/gen_nodes/tasks/main.yml b/playbooks/roles/gen_nodes/tasks/main.yml index b1a1946f..0fa778bf 100644 --- a/playbooks/roles/gen_nodes/tasks/main.yml +++ b/playbooks/roles/gen_nodes/tasks/main.yml @@ -20,6 +20,11 @@ register: my_group changed_when: false +- name: Skip node generation if using declared hosts + meta: end_play + when: + - kdevops_use_declared_hosts|default(false)|bool + - name: Create guestfs directory ansible.builtin.file: path: "{{ guestfs_path }}" -- 2.50.1