Skip to content

Instantly share code, notes, and snippets.

@res0nat0r
Forked from stefhen/migrate.txt
Created March 9, 2017 20:39
Show Gist options
  • Save res0nat0r/7790d2aa70749eaa82edf95313042a7d to your computer and use it in GitHub Desktop.
Save res0nat0r/7790d2aa70749eaa82edf95313042a7d to your computer and use it in GitHub Desktop.
Migrage Chef Client from old Chef Server to new Chef Server
http://stackoverflow.com/questions/28806585/how-to-migrate-from-one-chef-server-to-another-chef-server
There are multiple steps here and some information is needed from you to better answer your question.
Assumptions
Your nodes are Linux nodes and you are still working in the Chef 11 version.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment