How do you clone a virtualized Proxmox VE node?

Folks,

So, we're looking at automating the installation of our monitoring agent (Zabbix) on our Proxmox VE hypervisor nodes, and in order to do some testing of this stuff before we do it on real hardware, we have set up a VM for a nested Proxmox VE node, which we want to turn into a full cluster.

I found the page at <https://pve.proxmox.com/wiki/Duplicate_Virtual_Machines> easily enough, although that seems to be pretty specific to Debian and Ubuntu. However, making these changes does not seem to be sufficient to allow me to take an existing VM (or template) for a virtualized Proxmox VE node and clone that onto a second node, which I can then join into a cluster with the first node. After doing a clone operation like this, each node seems to continue to operate normally, but I can't get them to cluster together.

I've done some searching for this more complicated configuration, and so far I haven't come up with anything obvious. Does anyone here have any suggestions on the additional steps that might be required?

Thanks!
 
Some things, such as the machine ID, also need to be reset. Here is a small helper script that you are welcome to use and modify.

Bash:
#!/bin/bash

# Before executing the script, the following steps must be taken:
# - Adjust the IP under /etc/network/interfaces and /etc/hosts
# - Adjust the new host name here in the script

rm -rf /etc/pve/nodes/pvetemplate

# Info about the node
NEW_HOSTNAME="testmachine01"
DOMAIN="supertux.lan"

# Reset Machine-ID
rm -f /etc/machine-id
rm -f /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id

# Set hostname
hostnamectl set-hostname "$NEW_HOSTNAME"

# Update /etc/hosts: ignore IPv6, set FQDN & hostname
sed -i -E "/^127\.0\.0\.1\b/! {/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ s/^(\S+\s+)(\S+)\.$DOMAIN(\s+.*)?$/\1$NEW_HOSTNAME.$DOMAIN\3/}" /etc/hosts
sed -i -E '/^127\.0\.0\.1\b/! {/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ s/^(\S+\s+)(\S+)(\s+.*)?$/\1\2 '"$NEW_HOSTNAME"'/}' /etc/hosts

hostnamectl

echo "set hostname successfully to $NEW_HOSTNAME.$DOMAIN and /etc/hosts."

reboot