How best to re-IP VMs during a VMWare Datacentre Migration?

Posted by alex---z@reddit | linuxadmin | View on Reddit | 3 comments

I have a number of Linux VMs that need to be evacuated from an old datacentre. They will be copied/cloned across a link using VMWare based tools. They will need new IPs and other networking information etc assigned when they come back up at the other end.

I used Ansible quite extensively in my workplace, but obviously if the boxes come back up with their standard networking information they will be unable to talk to the network, so I'm trying to figure out the best solution to try to automate the network changes so I do't have to log onto each box via the console to reconfigure manually.

My current line of thought is to have a bash script added to the boxes just before migration that runs at startup, tries to arping the current default gateway, and if it fails trigger the necessary commands to replace the old config, then restart networking/reboot the server.

Does this seem like a sensible way to proceed, or can anybody suggest a better way?

Thanks in advance.