- Edit existing node name. Update name and save. Chef will copy the node and create a new client entry.
knife node edit oldnode
- ssh to node
- Change hostname and dns information
- stop chef-client
sudo service chef-client stop
- Change to /etc/chef
cd /etc/chef
- mv existing client.pem file to client-oldnode.pem
- make sure validation.pem file exists for chef organization
- edit client.rb update node_name "newnode"
- run chef
sudo chef-client
- "Net::HTTPServerException: 403 "Forbidden"" I had to log into manage and check mark the permission to let clients update. Permissions
- run chef
sudo chef-client
Chef Client Finished
- restart chef-client
sudo service chef-client restart
- Delete original node
chef-repo ‹master*› » knife node delete db02 -y; knife client delete db02 -y;
Deleted node[db02]
Deleted client[db02]
There's an easier way that doesn't require a new key for the client and you keep all the old node attributes etc.
knife node edit OLD_NODE
. Rename the node here and save. This makes a copy of the original node.knife client key show OLD_NODE default -F json | jq -r ."public_key" > OLD_NODE.pem
knife client create -p ./OLD_NODE.pem NEW_NODE
knife acl add group clients nodes NEW_NODE update,read
Feel free to delete the old client and node at your leisure.