Integrating with Chef


You can integrate with Chef to achieve the following goals:

  • Run BMC Varalogix Q Deployment Automation processes through chef-clients.
  • Run Chef recipes as a part of the BMC Varalogix Q Deployment Automation processes

With this integration, you can perform your deployments by using the BMC Varalogix Q Deployment Automation interface and through your existing Chef setup.

You can use the set of default actions available for this integration to trigger your deployments tasks. For more information, see Chef actions.

Environment requirements

Ensure that the following requirements are met to successfully to integrate with Chef and perform your deployments:

  1. Ensure that the BMC VaraLogix Q Deployment Automation dispatcher is running on the same computer as the Chef workstation.

    If you need multiple dispatchers for load distribution, then you must have multiple Chef workstations set up in your environment. You need one dispatcher for every single Chef workstation.

  2. The Knife command that you want to run must be integrated with the Chef repository. This is required so that the recipes or roles are updated on the Chef server during a knife cookbook upload.
  3. The chef-clients must be defined as nodes on the Chef server.
  4. All the servers that you create on BMC VaraLogix Q Deployment Automation must be named with the Chef node names.
  5. You must configure one cookbook for each dispatcher.

    By default, the cookbook is named as RLM_COOKBOOK_hostName. The hostName refers to the host name of the dispatcher server. 

    Since the cookbook upload performed by Knife, clobbers (or overwrites) any existing files on the Chef server, you must ensure that dispatchers do not share cookbooks or it may result in data loss.

Performing a deployment by using Chef

The following steps summarize the high level process involved in carrying out a deployment using your existing Chef setup:

  1. Deployments are broken up into triggered processes for each target (server) on BMC VaraLogix Q Deployment Automation.
  2. Recipes are created and added to a Chef role for the target (server). These recipes contain details regarding each of the deployment tasks (included in the processes on BMC VaraLogix Q Deployment Automation). When all recipes are created, the role is created and applied to the target (server).
  3. As each recipe runs on the target server, BMC VaraLogix Q Deployment Automation waits to listen for a recipe completion tag. This tag is generated by Chef when the recipe is posted to the Chef server.
  4. Once all the necessary recipe tags are collected by BMC VaraLogix Q Deployment Automation, a cleanup process is started to remove any roles, tags, and recipes generated earlier, in the process of deployment.

 

If BMC VaraLogix Q Deployment Automation times out waiting for the recipe tags, the deployment fails. In such a case, you might need to troubleshoot the issue and again run the deployment process.

 

Notes

  • Deployments do not occur until the process post deployment activities for the deployment task are successfully completed.  Each deployment process triggers the generation of recipes that are needed to perform the deployment task.  Deployment failures do not occur until the final process fully runs and the post deployment activities for that process are completed.
  • During a deployment, a chef-client needs to run multiple times to run recipes for roles it has been assigned. You can setup the chef-client to run automatically on an interval, or you can run it manually while the deployment process is waiting for completion of a process.

Integration workflow

The following figure and the associated steps describe the integration between Chef and BMC VaraLogix Q Deployment Automation:

Integration workflow

Chef integration workflow.png


Sample use case

The following use case describes an end to end deployment process involved for this integration:

Use case for Chef integration

This use case describes the deployment of a zip file on a target server by using the Chef setup and executing a Chef recipe as a part of the deployment process.

This deployment is described in the following steps:

  1. John logs on to his Chef setup and performs the following setup tasks:
    1. Configure a dispatcher on the Chef workstation. For more information about installing a dispatcher without running the installation program, see Installing and starting dispatchers.
    2. Ensure that the dispatcher is running on the Chef workstation has the necessary Knife commands integrated with the Chef repository.
  2. He now logs on to BMC VaraLogix Q Deployment Automation and creates a server pointing to the Chef node and the dispatcher so that BMC VaraLogix Q Deployment Automation can connect with Chef. For this, he navigates to System > Servers > New Server. He provides the following details and then clicks Create
    1. Hostname: The Chef node host name
    2. Create Channel Template: None
    3. Role: Unassigned
    4. Agent: Chef
    5. Dispatcher Server: Name of the server where the dispatcher is running.
    6. Remote Platform: None
  3. He now navigates to the Topology tab to create a topology consisting of channel templates, channels, environments, and routes necessary to perform the deployment, as follows:
    1. On the Topology > Channel Templates > New Channel Template page, provide the necessary details to create a channel template, "Chef_CT1:"
    2. On the Topology > Channels > New Channel page, select "Chef_CT1" as the channel template, and provide other necessary details to create a channel named, "Chef Channel 1."
    3. On the Topology > Environments > New Environment page, provide the necessary details to create an environment named, "Chef Dispatch Env 1."
    4. On the Topology > Routes > New Route page, create a route named "Chef Dispatch Route" by selecting the Type as Strict. Assign the "Chef Dispatch Env 1" to this route by dragging it from the Available Environments panel to the Environments panel.
      For more information about creating a topology, see Creating and managing the deployment topology.
  4. He navigates to the Define > Packages > New Package page, and provides details to create a package named, "Chef Dispatch Package." He adds a reference and an instance for this package, as follows:
    1. Click Add Reference to add a reference named "Single_File_Content" by providing the necessary details and selecting the Method as File.
    2. Click New Instance next to the package summary and provides the necessary details and create the instance.
      For more information about creating a package and adding references and an instance for that package, see Creating packages.
  5. He navigates to the Define > Processes > New Process page and creates a process called "Puppet Deploy zip file." He adds the following deployment activities on the Deployment Activities tab and then clicks Done:
    1. Create an activity called, "Send content" by using the Send Instance Content activity library to send the content pack to the appropriate directory on the target server.
    2. Create an activity called, "Unzip content pack" by using the Execute Command Line activity library to unzip the content pack on that directory. Add a dependency for the preceding activity.
    3. Create an activity called, "Execute Chef Getting Started Recipe" by using the Invoke Action activity library to execute the Chef getting-started recipe. Under the Configure panel, ensure that Generic is selected as the value in the first list available for Action Name. Select Execute Chef Recipe in the second list available for Action Name. In the Action Arguments box, specify getting-started::default. Click Done.
      For more information on creating processes, see Creating and managing processes and content.
  6. He navigates to the Deploy tab and deploys the relevant package. When the deployment begins, the process starts executing on the target servers.
    For more information about performing a deployment, see Creating and managing deployments.
  7. He checks the deployment results to verify if the deployment was successful or not.

Limitations

The following issues limit the scope of this integration:

  • The Config Get action used for pulling the configuration data from the Chef workstation into BMC VaraLogix Q Deployment Automation is not supported for remote platforms such as the chef-clients. It is only supported for the Chef server on which the dispatcher is running, to pull recipe names from the Chef server.
  • The Dispatch Fileget action is not supported for this integration.
  • The Dispatch Prun action is not supported for this integration.

Troubleshooting

You can use the following ways of troubleshooting failed deployments:

If a deployment process fails during the post processing which means when the post deployment activities are being run:

  1. In the log, check if a timeout waiting occurred for the recipe tag to be available.
  2. Verify the following items on the Chef server:
    1. Role has been applied on the target node.
    2. Role exists on the Chef server.
  3. Run the chef-client on the target host, look for any errors with running the recipes for the role assigned to the chef-client.

Resolution: If you find errors, resolve them and then restart the deployment. When you restart the deployment, you must only restart the post processing of your deployment. If your issues are resolved, you must be able to find all the necessary completion tags.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*