How would you configure a VM so that it will automatically register with a chef server?
I know that I could use knife bootstrap, however that is very tedious if you are starting dozens of servers at once.
The Chef documentation says to use
chef-client -j /etc/chef/file.json and bake the that into the image along with your client.rb and validation.pem files. However that still requires ssh-ing into the machine to run the
Is there not a more automated way to do this?
How do other people provision thousands of machines at once?
I contacted Chef support, they said you can start chef on boot in the following ways.
/usr/bin/chef-clientto the /etc/rc.local file and ensure you have a client.rb and validatation.pem files in /etc/chef
Use the chef-client cookbook to manage chef and control the init script.
They also said that the chef-client doesn't run as a daemon. Instead it only runs when it needs to do a convergence. (Which seems contradictory to the documentation.)
These solutions introduce new problems though. 1. You will have duplicate chef-client processes running if you add it to the rc.local file 2. You need to run chef in order to manage chef with the chef cookbook. How do you then clean up and unregister the node so that you can take a snapshot?