Use > Get started with Chef Cookbooks in SA > Set up your SA Environment to Handle Chef Cookbooks

Set up your SA environment to handle Chef Cookbooks

The following topics are discussed in this section:

Required user group permissions

SA provides user group Chef Group out of the box with all the necessary action permissions.

In addition to having the required action permissions, the user must be assigned the appropriate resource and folder permissions.

For detailed guidelines of the permissions for managing Chef Cookbooks, see Chef Cookbook Management Permissions.

Enabling an SA server to run Chef Recipes by installing the chef-solo-12.8.1 policy

In order to run Chef Recipes on an SA Agent-managed server, you must first deploy the Chef runtime environment on the server.

An SA Agent-managed server is a server that is managed by an SA Agent. There are multiple ways to deploy a managed server in SA, such as by SA Agent or a virtualization service. To run Chef Recipes, the servers must be managed by the SA Agent.

SA 10.1 ships with a single chef-solo bundled software policy that can be run on any supported server platform to enable the Chef Runtime Environment.

The chef-solo bundled policy contains the same open source Chef Client installers for each chef-supported platform that can be downloaded from the Chef Community, as well as two Application Configurations for the supported platform families: Chef Solo UNIX and Chef Solo Windows. This policy is provided directly in SA for your convenience.

Starting with SA 10.5, a new software policy, chef-solo-12.8.1 has been included. This software policy bundles chef-solo binaries. This software policy also supports the latest version of the open source Chef Client installers on chef supported platforms that are downloaded from the Chef Community. HPE recommends you to use chef-solo-12.8.1.

Note If you want to use your own version of open source Chef Client installers, you can create a software policy to include it.

chef-solo-12.8.1 bundled policy

After the Chef Runtime Environment is enabled on a server, that server can handle running Chef Recipes.

To implement this policy on a server, attach it to the desired server and remediate the server. The chef-solo bundled software policy will recognize the OS and platform of the server and deploy the correct package and Application Configuration on the server. This means that you do not need to find and select individual Chef Client installation packages for each server; the one bundled software policy contains them all and deploys the items that are required.

To deploy the chef-solo-12.8.1 policy and enable the Chef Runtime Environment:

  1. Attach the chef-solo-12.8.1 policy to the servers.
  2. Use your preferred method:

This will install the correct Chef Client installation package and Application Configuration on each of the attached servers.

These steps are described below.

Attach the chef-solo-12.8.1 policy to the servers

Method 1: To attach server(s) or device group(s) to the chef-solo-12.8.1 policy

  1. From the SA Client navigation pane, select Library > By Type > Software Policies.

    A list of supported operating systems appears in the content pane. Select the desired OS and platform to display the available software policies in the content pane.

    You may have to drill down the hierarchy a few levels to see the list of software policies.
    See Chef-supported platforms for a list of platforms with a Chef Client installer.
  2. Select the chef-solo-12.8.1 software policy. The policy details will appear in the lower pane.
  3. From the Actions menu, select Attach.... The Attach Server window appears.
  4. (Optional) Enable Remediate Servers Immediately to remediate the attached servers against the software policy.
  5. Navigate to the list of managed servers or device groups and perform one of the following steps:
    • Select All Managed Servers to view the server list.
    • Select Device Groups to view the device group list.
  6. From the content pane, select the desired servers or device groups.

    Note
    Only agent-managed servers can be used to run the Chef Recipes, so you must select SA Agent-managed servers or device groups containing agent-managed servers.

  7. Click Attach. The Remediate window will appear.

Method 2: To attach the chef-solo-12.8.1 policy to server(s) or device group(s)

  1. From the SA Client navigation pane, access the list of managed servers or device groups and perform one of the following steps:
    • Select Devices > Servers > All Managed Servers to view the server list.
    • Select Devices > Device Groups to view the device group list.
  2. From the content pane, select the servers or device groups.
  3. From the Actions menu, select Attach > Software Policy. The Attach Software Policy window appears.
  4. (Optional) Select Remediate Servers Immediately to remediate the servers against the software policy.
  5. Select the Browse Software Policies tab to view a flat list of software policies.
  6. Select the chef-solo-12.8.1 policy.
  7. Click Attach. The Remediate window will appear.

Remediate servers to deploy the chef-solo-12.8.1 policy

To remediate the servers to deploy the chef-solo-12.8.1 policy:

  1. Access the Remediate window from the server list or from the policy view:

    There are two ways to access the remediate window. Each is described below.
    1. To access the Remediate window from the server list:
      1. From the SA Client navigation pane, access the list of managed servers or device groups and perform one of the following steps:
        • Select Devices > Servers > All Managed Servers to view the server list.

          Or
        • Select Devices > Device Groups to view the device group list.
      2. Select the server(s) or device group(s) you want to remediate.

        Note
        Only agent-managed servers can be used to run the Chef Recipes, so you must select SA Agent-managed servers or device groups containing agent-managed servers.

      3. From the Actions menu, select Remediate....
    2. To access the Remediate window from the software policy list:
      1. From the SA Client navigation pane, select Library > By Type > Software Policies.
      2. Select the desired OS and platform to display the available software policies in the content pane. (You may have to drill down the hierarchy a few levels to see the list of software policies.)
      3. See Chef-supported platforms for a list of platforms with a Chef Client installer.
      4. Select the chef-solo-12.8.1 software policy. The policy details will appear in the lower pane.
      5. Select View > Server Usage. A list of the servers attached to this policy appears in the lower pane.
      6. Select a server or multiple servers, and then select Remediate... from the Actions menu.
  2. From the Remediate window, you can specify the remediation job options, run the job, and view the job status. The navigation pane in the Remediate window walks you through the following standard remediation steps.

    In each step, review and modify the settings as desired and click Next to proceed through the steps.

Step 1: Select servers and policies for remediation

  • This option will reflect the server(s) you selected in step 1. You can modify your selection within the job as well using the and icons to add or remove selected servers.
  • You can click Start Job at any point after Step 1 to run the remediation job. However, it is recommended that you review the optional settings before running the job.

Step 2 (Optional): Specify reboot, error handling, and script options for remediation

  • In the Reboot section, you can control when to reboot servers during the chef-solo Client Package installation or uninstallation.
  • In the Error Handling section, specify if you want to skip error handling when possible to minimize downtime.
  • In the RPM Rollback section, select the Create RPM Rollback point option to set the current server state as a rollback point. This preserves the current state in case you want to restore it later if something about a subsequent update fails.

Note
This option is only available and relevant on certain Linux servers.

  • In the Scripts section, specify if you want any scripts to run on a server before or after installation or uninstallation. You can specify different scripts on each of the four tabs in this section:
    • Pre-Download (Installation Only)
    • Post-Download (Installation Only)
    • Pre-Install/ Pre-Uninstall
    • Post-Install/ Post-Uninstall

Step 3 (Optional): Preview the remediation Job

You can preview a detailed list of actions that will be performed on a server as a result of the software remediation job. Information is displayed for each server or device group where the job will be run.

Step 4 (Optional): Schedule the remediation stages

The remediation process has three stages: 1) Analysis, 2) Download, and 3) Remediate. You can schedule specific times to run each stage, or set each stage to run immediately after the previous one completes.

Step 5 (Optional): Set email notifications for remediation

Set e-mail notifications to alert you or other users on the success or failure of the remediation process. You can associate a Ticket ID to identify and track this job.

Step 6: Run the remediation job and view job status

When you are satisfied with the job settings, click Start Job to run the remediation job.

When you run the remediation job, the Job Status window provides summary information about the job progress. You can also view the status of each action required to complete the job.

Chef-supported platforms

See the SA Support and Compatibility Matrix for SA-supported managed server platforms. See the Chef Community (https://supermarket.chef.io/) for Chef Client supported platforms.

Downloading Cookbooks from the Chef Community

Download the desired Chef Cookbooks from the Chef Community to your local machine to upload to SA.

  1. Point your browser to the Chef Community portal: https://supermarket.chef.io/
  2. Select a Chef Cookbook to download.
  3. Click Download and browse to a local directory to store the cookbook.
  4. Follow the on-screen instructions to complete the download.

After downloading the cookbooks to your local machine, you can upload them to SA and manage their usage. For details, see Use and manage Chef Cookbooks and Recipes.

chef-solo-12.8.1 bundle configuration in SA

The Chef standalone client, chef-solo, is installed and configured in SA by remediating the platform-independent software policy, chef-solo-12.8.1, located in folder Library/Opsware/Tools/Chef-12.8.1. The chef-solo-12.8.1 bundled software policy contains the platform installers for the platforms supported both by SA managed servers and Chef.

See Enabling an SA server to run Chef Recipes by installing the chef-solo-12.8.1 policy for details on the installation procedure.

The remainder of this topic section describes the configuration of the chef-solo configuration file, ‘solo.rb’, in SA.

chef-solo configuration file—solo.rb

Where the chef-solo configuration file is stored depends on the operating system of the server:

  • Unix: /etc/opt/opsware/chef/solo.rb
  • Windows: C:\Program Files\Common Files\Opsware\etc\chef\solo.rb

This section shows the integration-required parameters that go into the Chef’s solo.rb file, per operating system. You can add or remove parameters as needed for your implementation.

Unix solo.rb parameters

These parameters will be overridden in SA for Unix managed servers:

Setting

Default value in SA

cookbook_path

"/var/opt/opsware/chef/cookbooks"

file_backup_path

"/var/opt/opsware/chef/backup" 

file_cache_path

"/var/opt/opsware/chef/cache" 

node_path

"/var/opt/opsware/chef/node"

role_path

"/var/opt/opsware/chef/roles"

Windows solo.rb parameters

These parameters will be overridden in Windows managed servers:

Setting

Default value in SA

cookbook_path

"C:/Program Files/Common Files/Opsware/chef/cookbooks"

file_backup_path

"C:/Program Files/Common Files/Opsware/chef/backup" 

file_cache_path

"C:/Program Files/Common Files/Opsware/chef/cache" 

node_path

"C:/Program Files/Common Files/Opsware/chef/node"

role_path

"C:/Program Files/Common Files/Opsware/chef/roles"

Note
The template namespace is set to /system/chef and the filename key to /files/chef/solo_rb.