Chef is an infrastructure automation product that uses configuration recipes. The Abiquo Chef Integration allows you to deploy a virtual machine that will then configure itself using Chef recipes and roles. To run Chef you will need:
Naturally the best introduction to Chef is the Chef documentation: https://docs.chef.io
But here is a quick guide to Chef concepts for users of Abiquo.
The Abiquo Chef Integration will register your virtual machine as a Node and as a Client on the Chef Server.
Node list showing VM
Client list showing VM
The following sections will guide you through the configuration of Abiquo Chef Integration.
To use Chef features, your enterprise must have a Chef server (either a standalone server or an account on the hosted Chef server). There must be network access between your virtual machines and your Chef server. And the Chef server must have a list of cookbooks and/or roles that will be available for the virtual machines.
You will need to enter the admin client and the validator client details in the enterprise.
Chef Admin Client
On the Clients tab, open the Create page and enter the name of the client. Download the private key (.pem) file. Then go to the Groups tab and Edit the Admins group to add the new client.
Chef Validator Client
The validator client is the Organization's validator. To obtain the private key for the organization, go to the Organizations tab and click Regenerate validation key. By default the name of this key will be organizationname-validator.pem.
Load Chef roles into your hosted Chef account.
Load Chef cookbooks into your hosted Chef account.
Go to Users view and edit the enterprise, and open the Chef tab. Enter the details and click Save.
Tick this checkbox to enable Chef
Enter the URL of the Chef Server API
The validator client is used to create nodes. You must use the name of the validator client on the Chef server
The validator certificate, which may be stored in a file called organization-validator or validation.pem
This must be a Chef admin client on the Chef server. The Abiquo Server will use it to work with the Chef Server
The admin client certificate, which may be stored in a file called adminclient.pem
Now the enterprise is ready to deploy virtual machines and automate software installation with Chef.
For Chef in private cloud, you must use cloud-init templates and select cloud-init as the Guest setup method. Abiquo requires cloud-init version 0.7.9 or above.
In public cloud, for AWS or Packet, use templates that support the provider's user-data mechanism. For other providers, use templates that allow SSH access. You do not need to mark cloud-init as the Guest setup method.
You can include Chef in the name and description of the virtual template and choose the "Chef" category.
Edit the Chef Virtual Machine
To create VMs for use with Chef, drag and drop the appropriate templates to the virtual appliance in the usual way and save.
To create the Chef runlist, edit the VM and open the Chef tab to see the Roles available from the Chef Server of the user's enterprise.
Select the desired roles. You will see them in the Selected components pane.
To see Recipes (components of cookbooks), mark the Show individual components checkbox.
Now you will see both recipes and roles. You can select any combination of these, including recipes from roles you already selected. The selected components will be added to the Selected components pane to form the runlist in the order of selection. Use the slider button to move from page to page.
Set the run order by clicking the pencil edit button and changing the order.
When Abiquo deploys virtual machines, the chef-client is not configured to run periodically. So changes in the Chef configuration applied after the VM is deployed are not reflected in the VM itself.
To request updated recipes from the Chef Server, run the Chef client a regular intervals, to do this you could use a cron recipe as part of your Chef configuration on the VM.
When the virtual machine is deployed and booted, the chef-client will register the virtual machine as a managed node. Once this is done, it will download and install the selected recipes.
It is easy to change the recipes in a virtual machine, and this can be done live with the virtual machine running. Just select the virtual machine in Abiquo, edit it again, and check or uncheck recipes as desired. If the chef-client is set up to run periodically, when it runs, it will update the virtual machine.
If the virtual machine is not deployed, then it does not exist yet and there is no node on the Chef Server for that virtual machine. So the component list will show all available roles and recipes, allowing the user to select the required ones.
If the virtual machine is deployed, then it exists (even if it is stopped) and the node for this machine also exists on the Chef Server. So the component list will show the available recipes with the recipes in the run list for that node selected. So the component list always reflects the real recipe state for the virtual machine.
If someone updates the node directly in the Chef Server management console, Abiquo will detect this change and always display the right information.
Please see Troubleshooting Abiquo Chef Integration