From: Chuck Lever <cel@kernel.org>
To: <kdevops@lists.linux.dev>
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v1 3/6] guestfs: Refactor the construction of the virt-sysprep command line
Date: Thu, 2 Oct 2025 16:21:37 -0400 [thread overview]
Message-ID: <20251002202140.3596787-4-cel@kernel.org> (raw)
In-Reply-To: <20251002202140.3596787-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
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 <chuck.lever@oracle.com>
---
.../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
next prev parent reply other threads:[~2025-10-02 20:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 20:21 [PATCH v1 0/6] Enable users to set an alternate ssh port Chuck Lever
2025-10-02 20:21 ` [PATCH v1 1/6] ansible.cfg: Allow the use of alternate ssh ports Chuck Lever
2025-10-02 20:21 ` [PATCH v1 2/6] base_image: Make the semanage command available on base images Chuck Lever
2025-10-02 20:21 ` Chuck Lever [this message]
2025-10-02 20:21 ` [PATCH v1 4/6] guestfs: Use the alternate ssh port for Ansible control Chuck Lever
2025-10-02 20:21 ` [PATCH v1 5/6] terraform: Hoist the AWS cloud-init script into terraform/ Chuck Lever
2025-10-02 20:21 ` [PATCH v1 6/6] terraform: Use the alternate ssh port for Ansible control Chuck Lever
2025-10-02 20:25 ` Chuck Lever
2025-10-03 0:50 ` [PATCH v1 0/6] Enable users to set an alternate ssh port Luis Chamberlain
2025-10-03 13:44 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251002202140.3596787-4-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=kdevops@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.