Extending the product to use Chef cookbooks
This topic contains an overview of the BMC Server Automation Chef Field Kit and provides instructions on how to use the BMC Server Automation Chef Field Kit to execute Chef cookbooks.
The BMC Server Automation Chef Field Kit is a set of scripts that you can use to execute Chef cookbooks on the BMC Server Automation targets by using the BMC Server Automation deployment capabilities and Chef-solo. The field kit enables you to execute Chef cookbooks on the targets without having a Chef Server in your environment.
You can download BMC Server Automation Chef field kit (ChefFieldKit.zip) from the BMC Software Electronic Product Distribution (EPD) website. See Downloading the installation files for more information.
The advantage of using BMC Server Automation to manage the deployment of Chef cookbooks is that the managed nodes are already under BMC Server Automation management. BMC Server Automation provides robust transmission, staging, simulation, deployment, scheduling, and detailed reporting capabilities.
Also, BMC Server Automation system administrators can perform additional activities after execution of Chef cookbooks on the nodes without having knowledge of the Ruby code, which is required to write additional cookbooks and recipes. Additionally, if the same BMC Server Automation system administrators are performing regulatory compliance and patching activities on these servers and if they perform the application deployment activities through BMC Server Automation, the entire process provides stronger control of servers in your environment. Further, cookbooks can be reused into your production environment.
The following figure shows how the Chef field kit uses Chef cookbooks and executes them on the targets:
As part of the Chef cookbook deployment process, BMC Server Automation runs scripts to install Chef-solo on the target and then executes the cookbooks through Chef-solo, which must be included in a Chef-solo bundle. The script used to create Chef-solo bundles creates a BMC Server Automation Depot object and a Deploy Job. After these objects are created, you must download cookbooks and prepare them for import into BMC Server Automation. Also, you must create BMC Server Automation objects, which help you to deploy cookbooks into BMC Server Automation.
Before you use the Chef field kit
Before you start using the Chef field kit, ensure that the following prerequisites are met:
- Identify the OS and architecture of servers in your environment.
- Download the Ruby interpreter and its dependencies for your server OS and architecture. BMC recommends that you download them from the OS media to avoid any installation issues and runtime version mismatches.
- The servers on which you are planning to run Chef field kit scripts must have:
- The Ruby interpreter installed and available in path
- Connectivity to the Internet (cookbooks.opscode.com must be accessible).
- Either the curl or the wget utility installed and be available in path. curl or wget is used by the Chef field kit scripts in the priority order if they are available in path. If your server accesses the Internet via a proxy server and you have installed wget on the server, configure environment variables to provide information about the proxy URL, user ID, and password. For more information about configuring environment variables, see the wget documentation.
- The following Ruby gems installed: optparse, pp, tsort, rubygems, json, fileutils, and rest_client. The procedure for installing Ruby gems is provided in the README.text file that is bundled with the Chef field kit.
- NSH, Remote System Call Daemon (RSCD) Agent, and BLCLI installed.
- Chef uses native package management software (such as yum and apt) and package repositories of the target servers for installing the packages that are referenced in a cookbook. Ensure that targets are configured for and have access to package repositories (for example, RHN or RHN Satellite servers for Red Hat Linux) and have the appropriate package management tools installed and available in the path.
- Acquire BMC Server Automation credentials and perform the BLCLI authentication on the servers on which you are planning to run the Chef field kit scripts so that you can connect to the BMC Server Automation Application Server. Use the blcred cred -acquire command to acquire credentials.
- The authenticated role must have the following authorizations and object level permission on the target server and target server group:
- Ensure that the BL_AUTH_PROFILE_NAME environment variable is set to the authentication profile that you want to use.
The following figure shows the setup required for using the Chef field kit:
Using the Chef field kit
The process for using the field kit consists of the following steps: