From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DA4292874F7 for ; Thu, 2 Oct 2025 20:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759436503; cv=none; b=SF6mUBux1kZ8fNGD6Hfheoy6LsF/dfOtQC0SwbLZr3BY6wLZAs8HBIXWORaZkyow0eKjRmaQW7ZJ3qJnBs+XuCA251FOfroj5qyAVk8PYlXVWuQ1KtXk60Yj1LtAYX/x/A/x3TezKGp6wkzCLv891vpb/aGFOEMBcPCd5PnOK3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759436503; c=relaxed/simple; bh=zae/2pK7HQ3TcVTE93rAAQgGA/HtlqmgcWJgzzNbqeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H2hKN3dc5fQsHUC0cPVUYz4EbIxy0XRC4fPoueGNSiR1EI2Y9YUb98jrbyMSUCRh7SDDHodfOy03G+SujkVPDOLyfL57MzOIIp81bo1sdKnjDX8QaL8XspZZBdZtuWQiezDYmzgKHm6HCgPz9xqtIEUFDm9lCyvzbvfDGdE1uQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EQcSjOXG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EQcSjOXG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8305FC4CEF9; Thu, 2 Oct 2025 20:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759436503; bh=zae/2pK7HQ3TcVTE93rAAQgGA/HtlqmgcWJgzzNbqeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQcSjOXGSHX2nUrTlW2Dgu3E0P6/YUgh5N1kWG+ih5G4kmYm++Q5DZdhUzAMESx64 ZPZAoAPPxkXMhaD9JRTKdA8PEvdHGjWhBUb7NynDoenSPxRV7awK5EDjJ1ck6zORHc hQKVlKpJH8Cb/g6b21MvWjcdIbuHY+5jn2nFIJLygfUtxCRQWGsI67EiimFCq/XYq6 gXWnj36G+gigyPO7Ypk4/qTkpUB1fPXgOLYkKOlhmZ0Pb73K9omrWmE9RWjOw/01sW pIjpkI9719w8w80upXcxmb3V3BRg/ZuS8INAkHNTUMd+dGe6/8GWPxRB/YMubdOiWO /NUChrYVlKQow== From: Chuck Lever To: Cc: Chuck Lever Subject: [PATCH v1 3/6] guestfs: Refactor the construction of the virt-sysprep command line Date: Thu, 2 Oct 2025 16:21:37 -0400 Message-ID: <20251002202140.3596787-4-cel@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251002202140.3596787-1-cel@kernel.org> References: <20251002202140.3596787-1-cel@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 From: Chuck Lever Refactor: The virt-sysprep command line arguments are the same for both invocations. I'm about to add more complexity. There's no sense in duplicating that. Generated-by: Claude AI Signed-off-by: Chuck Lever --- .../roles/guestfs/tasks/bringup/main.yml | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/playbooks/roles/guestfs/tasks/bringup/main.yml b/playbooks/roles/guestfs/tasks/bringup/main.yml index e5fcbb2e1f21..ce7e4122d6e9 100644 --- a/playbooks/roles/guestfs/tasks/bringup/main.yml +++ b/playbooks/roles/guestfs/tasks/bringup/main.yml @@ -61,35 +61,30 @@ register: host_timezone delegate_to: localhost + - name: Build virt-sysprep command arguments for each target node + ansible.builtin.set_fact: + virt_sysprep_args: >- + {{ + [ + "virt-sysprep", + "-a", root_image, + "--hostname", inventory_hostname, + "--ssh-inject", "kdevops:file:" + ssh_key + ".pub", + "--timezone", host_timezone.stdout + ] + }} + - name: Build the root image for each target node (as root) become: true become_method: ansible.builtin.sudo ansible.builtin.command: - argv: - - "virt-sysprep" - - "-a" - - "{{ root_image }}" - - "--hostname" - - "{{ inventory_hostname }}" - - "--ssh-inject" - - "kdevops:file:{{ ssh_key }}.pub" - - "--timezone" - - "{{ host_timezone.stdout }}" + argv: "{{ virt_sysprep_args }}" when: - libvirt_uri_system|bool - name: Build the root image for each target node (non-root) ansible.builtin.command: - argv: - - "virt-sysprep" - - "-a" - - "{{ root_image }}" - - "--hostname" - - "{{ inventory_hostname }}" - - "--ssh-inject" - - "kdevops:file:{{ ssh_key }}.pub" - - "--timezone" - - "{{ host_timezone.stdout }}" + argv: "{{ virt_sysprep_args }}" when: - not libvirt_uri_system|bool -- 2.51.0