Use > Get started with Chef Cookbooks in SA > Chef management > Customize a Run Chef Recipe job

Customize a Run Chef Recipe job

Attributes are a basic concept in Chef and play a crucial role in managing a Chef node (a managed server in SA terminology). Chef attributes have different scopes and sources.

The SA custom attributes framework provides a way to pass attributes defined in SA at Chef runtime, during a Run Chef Recipe job.

The syntax used to define SA custom attributes for Chef is very similar to the one used to define Chef native attributes: all custom attributes applicable to a managed server (after scope resolution), whose names start with "chef_attr," will be passed to the Chef runtime.

The following figure is an example of how to override the proxy username and password that will be used by the yum cookbook. Notice that both " and ' can be used as separators. Using ' keeps the look and feel of the community Chef cookbooks:

See the SA Use section for more information about how to use SA Custom Attributes.

Retaining the job output

This section describes the Chef-solo log files on the SA Managed Server and the retain job output setting in the Run Chef Recipe job.

Log files on the SA managed server

There are two log files containing information regarding the chef-solo command execution on SA managed servers:

  • chef.log - contains the SA log of Run Chef Recipe Jobs and is additive
  • chef-solo.out - contains the full chef-solo command output for the last job executed on the managed server
    Where the chef-solo log files are stored depends on the operating system of the server:
  • Unix: /var/log/opsware/agent/
  • Windows: C:\Program Files\Common Files\Opsware\log\agent\

Samples of job results fields

Successful Run Chef Recipe job results display the chef-solo output if the retain job output was selected in the job options with a value >0 KB:

Successful Job Results


If the job failed, the Exception section will state the failure and provide the exit code, the error details and cause, and any action if there is one. This is displayed for all servers that are not successful:

Failed Job Results


Job results fields

 

Field

Description

Start time

time the job started

End time

time the job ended

Output

contains the chef-solo output if ‘Retain job output’ was selected and the ‘Size of the job output to retain’ was set to a value greater than 0 KB

empty if ‘Discard all job output’ was selected or ‘Retain job output’ was selected with 'Size of the job output to retain' set to 0 KB

Exit Code

Values are grouped into three categories:

negative values: failed Run Chef Recipe jobs where SA prerequisites are not met (such as missing permissions or missing dependencies)

positive values (native chef-solo error codes): failed Run Chef Recipe jobs where chef-solo fails

0: successful Run Chef Recipe jobs

Exception

displayed for all servers with ‘Failed’ Run Chef Recipe job status

Blocking a Run Chef Recipe job

You can block Run Chef Recipe jobs just as you can any software or script job via the Operations Orchestration job blocking function. See Blocking Jobs in the SA-OO Integration and Job Blocking and Approving sections in the SA Integrate section for instructions.