Bug 1954513 - RFE: Running ansible playbook by virt-sysprep?
Summary: RFE: Running ansible playbook by virt-sysprep?
Keywords:
Status: NEW
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-28 10:13 UTC by Pavel Raiskup
Modified: 2025-10-17 12:52 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-10-17 00:11:04 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.