0
I run KVM virtual machines on bare metal hosts. To spin up new VMs, I would:
virt-clone
a templatevirt-sysprep
the clone to make some basic changes- Start the cloned VM
- Use Ansible for further configuration
Currently, the first 3 steps are done using 1 Ansible script, and the last step is done with another. The first script acts on the bare metal host and the second script acts on the VM.
My question is, can this be performed in 1 script? One possibility is to change the inventory_hostname
in-flight in a playbook to target the VM after Step 3. However, I believe this isn't possible.
Is there a better way to do this? Thanks in advance!