Ansible
Virtum can run an Ansible playbook against the machines of a lab, from the host. ansible-playbook must be installed on the host (virtum doctor tells you).
yaml
ansible:
playbook: ansible/site.yml
requirements: ansible/requirements.yml # optional
machines:
web:
os: debian-12
groups: [front]
db:
os: ubuntu-24.04
groups: [data]playbook:is relative to the Virtumfile's folder.requirements:(optional) lists the collections and roles to install withansible-galaxy.groups:puts each machine into inventory groups.
On the first up
virtum up runs the playbook on the first deployment, then takes the provisioned lab snapshot. To return to that state:
bash
virtum snapshot restore provisionedsnapshot: in the ansible: section changes this: another snapshot name, or false to take none.
Running the playbook again
bash
virtum provision # runs the playbook again
virtum provision -- --tags init --limit web # arguments passed to ansible-playbookThe inventory
bash
virtum inventory # INI, on standard output
virtum inventory --format yaml # YAML
virtum inventory -o inventory.ini # writes to a fileThe inventory covers the lab's running machines, with each VM's SSH key.
Isolation
The playbook runs from a private copy of its folder, from which writable shares are excluded: nothing a VM can write is run on the host.
Limit
Only the playbook folder is copied. A file loaded by absolute path, or through ../ outside that folder, is not protected by the copy. See Security.