Can I automate vm instance setup with Multipass?

609 Views Asked by At

I'm using multipass to setup an Ubuntu virtual machine image. I'd like to make the installation of apt packages repeatable. Is it possible to script this somehow?

1

There are 1 best solutions below

0
On

You could create a cloud-config file and add it via --cloud-init option when launching a fresh VM. Cloud init lets you provision a VM on almost any cloud provider, it's a very versatile tool. That way you can add any package you want, create news users, run bash commands etc. . More on cloud-config files here.

You then run a cloud-config file with:

multipass launch -n your_vm_name --cloud-init path/to/cloudconfig/file.yaml