|
"Configuring my chef server with chef - it doesn't get any more meta than this" - bbrowningBootstrap in the context of this document refers to the initial configuration of a Chef Server for your infrastructure.The bootstrap install works using chef-solo to run chef recipes that install a full Chef Server.
Install ProcessInstalling chef-server using Chef Solo requires that you
The following sections explain each part of this process in detail. |
|
Install Chef-SoloChef-solo is packaged together with Chef-client. To install chef-solo on the host that will become your chef server, follow the directions to install chef-client: Configure Chef-soloYou need to give chef-solo a minimal configuration before it can run the bootstrap recipes. You need to configure two parts: chef-solo's own configuration file (/etc/chef/solo.rb by default) tells chef-solo where to store its files, and a JSON attributes file gives chef-solo the values it uses to configure your Chef Server. Chef Solo Configuration File: solo.rbWe're going to use Chef Solo to run the bootstrap recipes, so it needs to be configured to point the right locations. First, create a chef directory in /etc Now create a chef-solo configuration file. Save it as /etc/chef/solo.rb. Edit /etc/chef/solo.rb Chef Solo Attributes Configuration: chef.jsonChef can use JSON data passed to Solo or the Client to specify a certain list of recipes to run and specific Attributes to configure on the system. We're going to configure the node with a JSON file particular to whether it will be a Chef Server or a Chef Client. Create the file ~/chef.json with the applicable contents below. Chef Server with no webui: Server Attributes (API Only) Chef Server with the webui installed and enabled: Server Attributes (API and WebUI) Set The Init Style For Your SystemThe bootstrap recipes currently default to using runit as the init system. We're big fans of runit, but you might prefer a different init system.
If you need to specify a different init system, add the init_style attribute to your chef.json: Server Attributes for Using Your System's Default Init System There are a lot of other attributes available to configure for the Chef Server. See the Chef Server Cookbook README for complete details. Bootstrap Chef ServerThis procedure will set up the chef-server-api to run on port 4000 using the thin adapter, and optionally the chef-server-webui on port 4040. SSL encryption can be provided by proxying with Apache. The webui is now separate from the API, so it is now optional. Setting the attribute webui_enabled to true will install and configure it. Run chef-soloChef Solo Installs and Configures Chef Server
This command will bring up the Chef Server by doing the following:
Verify That All Components are RunningNow that you have Chef Server installed, you should have the following processes running.
Configure the Command Line ClientOnce you've verified that all of Chef's components are working, it's time to configure the knife command line tool. On your Chef Server, run knife configure -i to interactively configure your knife client and create an admin account on the server. You can accept the default responses shown in brackets by pressing <enter>. First, create the ~/.chef directory and copy the required certificates created by the server.
Next run the knife configure command, and pass the -i flag so the initial client that will be used to authenticate with the API. API Client creation must use an existing admin client's credentials to create the new account. On a brand new server, the chef-webui is created by chef-server-api startup. Use the default for the clientname, and specify the webui.pem copied above. The "chef-validator" client is a special account used to auto-register new nodes. Use the default clientname, and specify the validation.pem copied above. Finally, specify a location for the Chef Repository. This is used to configure knife to point to the directory where Cookbooks will be stored. Verify Your Knife Client ConfigurationYou can now run some basic knife commands to verify that you can communicate with the server. Create a Knife Client for Your Laptop/DesktopCreate Your Client AccountWhen working with chef, you will spend a lot of time editing recipes and other files, and you'll find it much more convenient to edit them on your laptop/desktop (your management workstation), where you have your editor configured just to your liking. To facilitate this mode of working, we recommend you create a knife client to use knife on your development machine. Make sure you've configured knife on your chef server as described above before proceeding with this step. This command creates the client and writes its private key to /tmp/my-username.pem. To verify the operation, use the knife client show command: Copy Your Key and Configure KnifeNow you need to copy the key you just created to your development machine using scp (or some other file copy mechanism). In order to use knife on your laptop, you'll need to install the chef-client. If your laptop's OS comes with rubygems (Mac OS X, for example) you can run sudo gem install chef; otherwise, check out the client installation instructions for your OS. Once you have chef installed, you can use knife's interactive configuration on your laptop (note we're not using the -i option here): Knife looks for its configuration in HOME/.chef/knife.rb by default: Now, enter your client name, exactly as you did when running knife client create above: For these next settings, you can accept the defaults for now and update them later by editing your knife.rb file. The validation client name and key are used with knife's cloud computing commands: We'll also leave the path to the chef repository blank for now. After you've created a chef repository, you'll want to configure it by editing knife.rb Verify Your ConfigurationYou can run some list and show commands to verify everything is working: You're now ready to use Knife Bootstrap to automatically set up systems to become new Chef Clients to the server. CentOS/RHEL Installation Notes
|
|
|


