How do I handle a IP change affecting many servers?

Due to a location change, we have to move a number of servers to new IP addresses (from 10.X.*.* to 10.Y.*.*). We’re taking the opportunity to clean up our IP allocations from a haphazard setup to a more orderly one, so there’s not much correspondence between old and new IPs. The systems are nearly all:

  • running Ubuntu (14.04, with a couple of 12.04 and one odd 10.04 that we’re planning to upgrade)
  • managed somewhat by Puppet and Foreman (mostly package installation and service configuration)
  • configured with etckeeper to keep functionality-related configuration in git
  • configured with static IPs via /etc/network/interfaces.

Currently, we have two options:

  • Make all the changes in advance in copies of files, and when the server is brought back up after the move, switch the files using a script.
  • Make all the changes in advance in a git branch, and when the server is brought back up after the move, do a git checkout new-branch (or a merge changes, as per convenience).

Essentially, both methods are the same, just the tools used are different. Of course, there’s also the manual method, but that would be error-prone.

Changes to be made involve updating IPs in interfaces, DNS server IP, nagios, munin configuration IPs, and so on.

What other options do I have?

Answer

In the end, we decided to use the git method, and changing IPs was the least of our troubles. 🙂

The procedure:

  • Use Puppet to install and set up etckeeper, and create a repo for each server on our Gitlab instance. We chose to use a gitignore that ignored everything except select files and directories.
  • Have team members create a branch (with a common name, like newip) with the required changes.This exercise also involved adding any files or directories of interest to git, adding exceptions to gitignore.
  • Review the commits on the new branch.
  • On the day of the switch, cd /etc; git fetch origin newip:newip && git merge newip on each system, before bringing it down.

We got a couple of merge conflicts, from changes made to test other options (and were not undone), but these were easily resolved.

Attribution
Source : Link , Question Author : muru , Answer Author : muru

Leave a Comment