OpenTofu For Managing LibVirt VM deployment

Hello All,

Looking for some recommendations and insights.

I would like to deploy copies of an existing template Libvirt VM; which has been previously provisioned with RHEL and all needed applications. I am looking to try an automate this process by doing the following.

  1. copy the template vm to a new vm-name
  2. change the hostname of the copied Linux VM
  3. change the static IP address(static IP is a requirement)
  4. launch the newly provisioned linux-vm

Is OpenTofu a good choice for doing this or is there a simpler approach?

Any ideas or suggestions, would be very much appreciated.

Thanks!

Never heard of opentofu, but you missed a step: generalization. On a Windows VM you’d do this by running sysprep; on a Linux VM you need to force it to generate a new machine_id.

Thanks Jim, I’ll look into that.

So the OpenTofu, is an alternative to Teraform; which seems to be the preferred to deploy VMs. I must admit that I’m new to these tools, but wanted to see if I could leverage them for automation of VM deployment. Although my preference is to probably modify the xml file, etc.. but was concerned about missing any files doing this so I was looking for a tool to help.

Thanks again!

I generally deploy manually. But I do use gold images, which is why I immediately knew to warn you about the generalization step. :slight_smile:

As always, Thanks very much for your insights and advise.

1 Like