Using a VM to make a template
https://pve.proxmox.com/wiki/VM_Templates_and_Clones
Clean machine id
truncate -s 0 /var/lib/dbus/machine-id
Delete ssh-ids from host
sudo apt-get install openssh-client
Make sure cloud-init is installed and clean old configs
cloud-init clean
2 ways of config
(on minute 12)
1 - Poweroff and config it via proxmox web interface:
1.1 - In Hardware section, remove cd and add cloudinit drive. I use same storage, but it's up to you.
1.2 - In Config-Init set your configurations
1.3 - Click "Regenerate Image"
1.4 - Right click over machine and "Convert to Template"
or
2 - Make a backup for cloud-init config file
https://cloudinit.readthedocs.io/en/latest/index.html
vim /etc/cloud/cloud.cfg
*Follow https://www.youtube.com/watch?v=exeuvgPxd-E and https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_cloud-init_for_rhel_8/configuring-cloud-init_cloud-content
2.1 - Disable default user and create your own if you want to.
2.2 - Make a hash for new user password:
password: [password for hashing]
2.3 Copy the hash
2.4 Config users section:
users:
# - default
- name: bastian
lock_passwd: False
passwd: $6$.dgzhPp/B1SCrT/$E5hmxTUp.9HLXvFgLSFdI7tkafJOEmACprculpQ0 [...]
gecos: Bastian
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAA5153SDFFGRewavaer5646 [...]
groups: [adm, sudo]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
(mind the indentation)
2.5 Config timezone if you want to:
- timezone "America/Cuiaba"
2.6 Store initial data and install packages adding this lines at the end:
bootcmd:
- date > /etc/birh_certificate
packages:
- git
2.7 Poweroff
2.8 - Right click over machine and "Convert to Template"
IMPORTANT NOTICE: This image was Image by storyset on Freepik