Debian 9 template

Peppe2201

Active Member
Aug 28, 2018
14
2
43
24
Hi guys,
I just want to clone a KVM Debian 9 virtual machine, it's just a stock image.
I'm trying with cloud-init, I need for each cloned machine different hostname and IP address (manually setted), obviously different MAC address.
I also need to execute a command and after that reboot the VM.
I'm having a lot of problem with cloud init, it added tmpfiles clean, changed the timezone, locale, ecc. and I don't want all of that, I just want different hostname, IP and the script executed.

How can I do? Are there simplest way to achieve that?
 
Hi
My tract is slightly different but it might help. I'm using PVE 5 and SaltStack to clone a template, rename and re-IP with Cloud-init, and finally install applications, Apache etc.
I used a Cloud-init image to make things easier (https://cdimage.debian.org/cdimage/openstack/), that way I knew Cloud-init was working.

Add a cloud-init drive to your template in PVE (Hardware/Add/Cloudinit Drive) and then set a default hostname, IP address, DNS etc in Cloud-Init Drive in PVE and hit the regenerate image.

I get Salt to clone the template and set the CPU/memory etc. After the clone is complete change the hostname and IP address in the cloned VMs Cloud-Init Drive before booting.

When the new VM boots, cloud-init will read the cloud-init drive and update the hostname etc.

Tokala