Examples
Some examples are provided here for demonstration and convenience.
Provisioning script
If you have a lot of run-command directives in your customize section,
you might prefer to put your commands in a script and use virt-builder's run directive instead.
In this example, 'setup.sh' exists in the same directory as the virtfile.
The run directive copies it to the VM and executes it.
Or, if you want a script to run during first-boot when the VM is actually running,
you can use the firstboot option. Both are demonstrated below:
Example: using scripts for customisation
virtfile
source: virt-builder
image: fedora-42
customize:
- install: openssh,nginx
- run: provision.sh
- firstboot: firstboot.sh
machine:
- vcpu: 2
- memory: 2048