Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate from one chef-server to another chef-server

I have an existing chef-server setup with around 300 nodes registered to it. Now I would like to move to another chef-server with an updated version. However I am not sure of how we can migrate all the nodes and other data from older chef-server to the newer one.

like image 941
user3540835 Avatar asked Mar 02 '15 09:03

user3540835


1 Answers

There are multiple steps here and some information is needed from you to better answer your question.

Assumptions

  1. Your nodes are Linux nodes and you are still working in the Chef 11 version.
  2. Your new chef server has all of the cookbooks, roles, data bags and environments moved over from your old chef server.

Steps

a) First make sure you have inventoried your current chef setup so you know what all your node names are and what run-lists are applied to each node.

b) SSH into a node you want to move and delete /etc/chef/client.pem

c) Now login to your new Chef server and use the private key in /etc/chef/chef-validator.pem contents to create /etc/chef/validation.pem on your client machine.

d) Edit /etc/client.rb and change the chef_server_url to whatever your new chef server is.

Now run chef-client on the client machine. This will create a new client identity from the new server and you should see the name of your client appear in your chef server's the /clients listing of your new Chef server.

But you're not out of the weeds yet because: i) your clients run-list will be empty and ii) this client does not yet appear in the /nodes listing of your new server.

d) So you need to use the

knife node create NODE_NAME

command from your workstation to name the node and log it in your new chef server's database.

Then use

knife node run_list add NODE_NAME RUN_LIST_ITEM(s) 

to re-create the run-list for each box.

Then use

knife node environment_set NODE_NAME ENVIRONMENT_NAME

to set the environment for each node.

Now run chef-client on the node and you should see the node in /nodes with the run lists and environments you assigned. You should also see the node in the status tab with a very recent Last Check-in time.

Yes. You would have to do this 300 times. Ow.

like image 178
Rob Ray Avatar answered Nov 15 '22 12:11

Rob Ray