Page tree

This topic provides an overview of the out-of-the-box Chef integration that is available starting with version 8.7. This topic includes the following sections:

Overview of the integration

The Chef integration (available in version 8.7), enables you to leverage Chef-solo content without having to provision a full-fledged Chef infrastructure in you environments. This feature enables you to:

  • Create content (depot objects and jobs) for deploying the Chef-solo agent
  • Create content (depot objects and jobs) for deploying Chef cookbooks, roles, environment, and databags.

Two new wizards enable you to execute NSH Scripts and NSH Script Jobs that are installed out-of-the-box with BMC Server Automation version 8.7.

The scripts import Chef cookbook(s), roles, environment, databags and pre-requisites (such as Ruby) and generate Depot Objects such as Software Depot Objects and BLPackages as well as the corresponding Deploy Jobs to help users deploy a Chef cookbook (and if needed, its prerequisites) on servers managed by BMC Server Automation.

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.

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. You must download cookbooks and import them into BMC Server Automation prior to using the integration.

For more information about Chef-solo, see the Chef online technical documentation .

Requirements for the integration

Before you start using the Chef integration, ensure that the following prerequisites are met:

  1. Identify the OS and architecture of servers in your environment.
  2. Download the Ruby interpreter and its dependencies for your server OS and architecture and ensure they are deployed to the target servers. BMC recommends that you download them from the OS media to avoid any installation issues and runtime version mismatches. For an example of how to deploy applications using BMC Server Automation, see Walkthrough: Packaging applications with BLpackages.
  3. The servers on which you are planning to run Chef field kit scripts must have:
    1. Connectivity to the Internet (cookbooks.opscode.com must be accessible).
    2. Either the curl or the wget utility installed and be available in path. curl or wget is used by the Chef integration 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.
    3. NSH, Remote System Call Daemon (RSCD) agent, and BLCLI are required if you are executing the scripts from the command line. (BLCLI and NSH are part of the RCP Client install, but BLCLI is not part of the stand-alone NSH installer)  
    4. The RCP console is required if you running the Chef scripts from the GUI.
  4. 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.
  5. Acquire BMC Server Automation credentials and perform the BLCLI authentication on the servers on which you are planning to run the Chef integration scripts so that you can connect to the BMC Server Automation Application Server. Use the blcred cred -acquire command to acquire credentials (blcred is part of the RCP Client installation).
  6. The authenticated role must have the following authorizations and object level permission on the target server and target server group:
    • BatchJob.* 
    • BLPackage.*
    • DeployJob.*
    • DepotFile.*        
    • DepotFolder.*    
    • DepotGroup.* 
    • JobFolder.*
    • LinuxSoftware.* 
    • NSHScript.*
    • NSHScriptJob.*
    • Server.*
    • ServerGroup.*
  7. Ensure that the BL_AUTH_PROFILE_NAME environment variable is set to the authentication profile that you want to use.
  8. In addition, the authorization profile must also have following object level permissions:
    • Server.* on Target Server
    • ServerGroup.* on Target Server Group
    • JobFolder.* on the Chef and ChefAdministration Job folders
    • DepotFolder.* on Chef and ChefAdministration Depot folders
    • NSHScriptJob.* on the ChefDeployScriptJob, Cookbook2BlPkgScriptJob, and the ChefPackagerScriptJob jobs present in the Jobs/Chef/ChefAdministration folder
    • NSHScript.* on the ChefDeployScript, Cookbook2BlPkgScript, ChefPackagerScript scripts present in the Depot/Chef/ChefAdministration folder

Script overview

The following table provides descriptions of the scripts that are available for your use out of the box, after installing BMC Server Automation (version 8.7 and later).

By default, the scripts are located in the <installation_directory> BMC Software > BladeLogic > NSH > br > autoimportcontent > chefscripts directory.

ScriptDescription
Chefpackager.nsh

The Chefpackager NSH script is used to create the Chef Agent bundle and the Chef Agent deploy job.

One of the main pre-requisites for deploying Chef cookbooks on targets is that those targets must have Chef-solo agent installed on them.

This script takes the Chef-solo installer file locations as input, as well as the Ruby installer file location, as Chef depends on Ruby, and any other generic dependencies. The script also requires the OS, version and architecture as inputs.

Cookbook2blpkg.nsh

The Cookbook2blpkg NSH script is used to create the BMC Server Automation objects (BLPackages, Deploy Jobs, and so on) required for deploying the cookbook.

This script creates a BLPackage and two jobs for each cookbook that is imported.

  •  The first is a Deploy Job is a simple BLPackage deploy job which deploys only the Chef cookbook, assuming that the target already has Chef-solo, Ruby, and so on.
  • The second is a batch job that combines:
    • A NSH script job for installing the Chef-solo Agent, Ruby, and so on on the target (if needed).
    • The Chef cookbook BLPackage Deploy Job
ChefDeploy.nshThe ChefDeploy NSH script is used by the Chef agent Deploy Job and the Chef cookbook Deploy Job and is automatically executed when those Deploy Jobs are executed.

Where to go from here

Walkthrough: Running Chef cookbooks from the BMC Server Automation console 

or

Executing Chef scripts from the command line