Is it ok to simply clone a vmware image of an Ubuntu server if I need a new load balancer node?

Is it ok to simply clone a vmware image of an Ubuntu server if I want an exact copy to run as a load balancing node? I realize I, at the very least, have to change the new machine's ip address and name, but are there any other things I should be aware of?

Clarification: The server is a standard installation running nginx and haproxy as a http loadbalancer and ssl proxy for some websites.


Solution 1:

Assuming there is nothing service-specific tied to the network address or host name, all you should need to do is change both. I usually change them in the config files before I clone, without applying them, so the new box is ready to go, and then change them back to what they were on the original node after cloning.

Another slightly safer option is to add a one-time init script to make the changes before you clone, clone the system, then disable that one-time script. This script should check something like the MAC address to make sure it is really on a "cloned" node before doing anything disriptive to the hostname or IP.

Regenerating SSH keys, random seed files, or anything else that is "per machine" and security related is also probably something you should do on the new node once it is up.

Solution 2:

The biggest thing I've found is that udev doesn't like cloned NIC cards and tends to create new instances. This can be a real headache depending on exactly how you have things set up. You should take a look at the udev rules (at /etc/udev/70-networking or similar) and pull out all the contents listed there on your cloned system. On reboot it should act much more as expected.

Disclaimer: I've used Ubuntu server a bit but most of my time is spent with CentOS.

Solution 3:

It completely depends on the installed services.

A server which is hosting lots of static files through Apache could be easily cloned. A mail server, database server or something else might not be cloned as easily.