Bug 1954513

Summary: RFE: Running ansible playbook by virt-sysprep?
Product: [Community] Virtualization Tools Reporter: Pavel Raiskup <praiskup>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: mhicks, ptoscano
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-10-17 00:11:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Raiskup 2021-04-28 10:13:58 UTC
It would be nice if virt-sysprep accepted e.g.
`--ansible-playbook some-playbook.yml` and automatically executed the
tasks there against the spawned machine.

Comment 1 Richard W.M. Jones 2021-04-28 10:18:37 UTC
What actual command should be run inside the appliance?

Comment 2 Pavel Raiskup 2021-04-28 10:37:59 UTC
Not much inside ... only the necessary steps to be able to
run ansible-playbook from the outside *against* the appliance.

Comment 3 Richard W.M. Jones 2021-04-28 11:50:18 UTC
I suspect that getting a network connection from the outside world to the
appliance is going to be the problem here.  The userspace network stack
we use (SLIRP) does not easily support this (without invasive changes to
libguestfs).

To move this on you should do this:

  $ virt-rescue --network --scratch

and see if it's possible to get ansible on the outside to configure
inside this appliance, then detail what steps have to be taken to make
that work.  Note using SLIRP port forwarding is not really an option.

Comment 4 Pavel Raiskup 2021-04-28 12:06:07 UTC
I bet it's non-trivial, but it should ideally work without the network
connection.  There seem to be a whole bunch of existing connection plugins in
Ansible other than ssh:

    $ ansible-doc -t connection -l
    buildah      Interact with an existing buildah container
    chroot       Interact with local chroot
    docker       Run tasks in docker containers
    funcd        Use funcd to connect to target
    httpapi      Use httpapi to run command on networ
    ...

And perhaps we can think of a custom one in this case?

Comment 5 Pavel Raiskup 2021-04-28 12:09:53 UTC
> To move this on you should do this:
> 
>   $ virt-rescue --network --scratch
> 
> and see if it's possible to get ansible on the outside to configure
> inside this appliance, then detail what steps have to be taken to make
> that work.  Note using SLIRP port forwarding is not really an option.

I'll try to poke at this later and provide feedback, thanks for the tip.

Comment 6 Red Hat Bugzilla 2025-10-17 00:11:04 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.

Comment 7 Alasdair Kergon 2025-10-17 12:52:13 UTC
Reopening because Virtualization Tools has not been discontinued.