[PATCH 4/9] base_image: diy: add callback support to virt-customize tasks

Daniel Gomez <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

Adds DIY callback variables to both root and non-root virt-customize
tasks to display the executed command and output. This improves
visibility into the custom image preparation process by showing:

- The actual virt-customize command being executed
- Real-time output from the virt-customize process
- Package installations, user creation, and system configuration steps

Uses the correct DIY callback variable structure:
- ansible_callback_diy.result.output.cmd for the command array
- ansible_callback_diy.result.output.stdout for command output

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 playbooks/roles/base_image/tasks/custom-image.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/playbooks/roles/base_image/tasks/custom-image.yml b/playbooks/roles/base_image/tasks/custom-image.yml
index febb570d..baf481ec 100644
--- a/playbooks/roles/base_image/tasks/custom-image.yml
+++ b/playbooks/roles/base_image/tasks/custom-image.yml
@@ -185,6 +185,10 @@
       when:
         - libvirt_uri_system|bool
         - not sentinel_stat.stat.exists
+      vars:
+        ansible_callback_diy_runner_on_ok_msg: |
+          $ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
+          {{ ansible_callback_diy.result.output.stdout | default('') }}
 
     - name: Customize the downloaded image with kdevops user and settings (non-root)
       ansible.builtin.command:
@@ -197,6 +201,10 @@
       when:
         - not libvirt_uri_system|bool
         - not sentinel_stat.stat.exists
+      vars:
+        ansible_callback_diy_runner_on_ok_msg: |
+          $ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
+          {{ ansible_callback_diy.result.output.stdout | default('') }}
 
     - name: Clean up the virt-customize command file
       ansible.builtin.file:

-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.