Knowledge base
How to set up Chef to work with Oktawave?
Posted by on 11.07.2013 16:16

Chef allows OCI management automation in Oktawave. With it, you can run instances that will include sets made by you (so-called regulations) and software configurations. Chef gives you the ability to run or remove instances on your account from the console.

In this guide, both the client and the Chef server will be installed on the same OCI in the ubuntu 12.04. The client can also be on your local computer on which you will create the rules and then sending them to the Chef server, where they will be applied to instances.



At the beginning we will start the installation of the Chef console client - Knife, with the module for managing instances in Oktawave. Lets make sure that we have the following packages on the system.

sudo apt-get install git ruby1.9.3

Now we will install the Knife, with the Oktawave-knife module.

sudo gem install knife-Oktawave

Create a directory .Chef in your home directory.

mkdir ~/.chef

Inside of this directory create file knife.rb - file that contains our access data to Oktawave.

knife[:oktawave_login] = 'USER'
knife[:oktawave_password] = 'PASSWORD'

At this point, we have the opportunity to list our instance, enable/disable them, etc.

#listowanie instancji
knife oktawave oci list
#lista dostępnych komend
knife oktawave


Chef server

Knife utility shows its full potential when we use it to create Oktawave instance. Not only Knife can automate this process, but each instance created in this way can have a prepared set of our application suite and be properly configured.

Before beginning installation of chef server, note that there are two more things.

  • First, in order to use the Chef Server, we will need the domain name of the server where you want to install it. By default, each new instance of the Oktawave has the name in the format [identifier] We can see this by calling the command hostname-f or check on the OCI tab in the admin panel. For this tutorial, we'll use just the default domain name. However, there is nothing preventing you to use your own address. In that case, remember to create proper DNS record on the servers that store data about your domain, that point to the instances running Chef Server, set the hostname in the instance corresponding your name and use it to set up Chef Server and knife.
  • Second, the Chef Server installs its own Web server and the database. In order not to conflict with this type of software existing on OCI it would be best to install Chef on a new instance.

We go to page and in the Chef Server tab we select the entries corresponding to the system, in which we want to install the software. Copy the link, download the Chef on the server and install it.

sudo dpkg -i chef-server_11.0.8-1.ubuntu.12.04_amd64.deb


Run the command to configure the Chef Server.

sudo chef-server-ctl reconfigure

In the /etc/chef-server directory should now contain files such as admin.pem and chef-validator.pem that our client need. So copy it to the previously created folder .chef.


cp /etc/chef-server/admin.pem ~/.chef/
cp /etc/chef-server/chef-validator.pem ~/.chef/

When we have a client installed on the local computer, we need to download these files from the server, eg using scp command.

The next step will be to clone (for example, to our home directory) chef-repo repository that contains the directory structure that will be used by the Knife. If the Knife is used on the local computer, then there should be a repository cloned.

git clone git://

Now you are ready to connect the knife to the Chef server, using the knife configure -i command.


knife configure -i
Overwrite /root/.chef/knife.rb? (Y/N) Y
Please enter the chef server URL: []
Please enter a name for the new user: [root] user
Please enter the existing admin name: [admin]
Please enter the location of the existing admin's private key: 
[/etc/chef/admin.pem] ~/.chef/admin.pem
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: 
[/etc/chef/validation.pem] ~/.chef/chef-validator.pem
Please enter the path to a chef repository (or leave blank): ~/chef-repo
Creating initial API user...
Please enter a password for the new user:
Created user[user]
Configuration file written to /root/.chef/knife.


Sample answers to the questions you see above. Pay attention to the specified Chef Server URL, which is the domain name of your OCI, indicating the use of https. The paths to the key point to the place where he had copied the files admin.pem and chef-validator.pem, and the path to a chef repository is the location of the folder you created the cloned repository chef-repo.

This operation overwrites knife.rb, so again you need to add to it your Oktawave account credentials.

You can now also visit the Chef Server web panel, which can be found at https:// [domain_name_of_instance] (the same URL that you specified in the first question), log in with the newly created user data (answers to the questions: name for the new user and password for the new user). At this point, most of the section will be empty, but soon this will change.



Under the term bootstrap lies creation operation, start-up and the imposition of a set of ready-made configurations for OCI instance. Description of software included in the machine and how it should be configured, we call recipe. Recipes can be combined and accumulate in the role that we can assign to the created instance (in Chef it will be visible as a node).

We can create our own Recipes, in which Chef documentation may be helpful We may also use Recipes prepared by other users, published here:, which is the resources that we will use.

Suppose that we are fans of zsh shell and git version control system. We would like for each of our instances to have this software already installed. We can search for ready recipe.

knife cookbook site search zsh

We found zsh recipe, that suits our needs, so we will install it.

knife cookbook site install zsh

We do the same with git (knife cookbook site install git). You should also use a recipe called apt (knife cookbook site install apt), which will provide up to date installation packages.

Downloaded recipes are still only in our local repository (~/chef-repo/cookbooks/), we can now upload them to the Chef server.

knife upload cookbooks

You can see the list of rules registered on Chef server by executing a command.

knife cookbook list

Or browse Cookbooks section in webpanel.

Now we will create a roll that contain recipes installed moment ago. In the first step, specify text editor that you will use.

export EDITOR=vim

And then create a role called mylinuxserver.


knife role create mylinuxserver


Now edit the opened file and in the run_list section put rules that you want to be applied on OCI and run with the mylinuxserver role.

  "name": "mylinuxserver",
  "description": "",
  "json_class": "Chef::Role",
  "default_attributes": {
  "override_attributes": {
  "chef_type": "role",
  "run_list": [
  "env_run_lists": {

We can finally start to run instances in Oktawave. Let us list of available machines.

knife oktawave template list

Lets choose, for example debian version 6.0.7, which Category ID is 6 and create an instance with name mydebian with assigned mylinuxserver role.

knife oktawave oci create -T 6 -N mydebian -r 'role[mylinuxserver]'

We can now observe OCI initialization process and applications from our recipes. If the process is interrupted for some reason, we can resume it, using the command specified by the program.

knife oktawave oci create --bootstrap-oci [ID_INSTNCJI] -r 'role[mylinuxserver]'

When finished, we get the OCI with installed zsh shell and git program. The instance is also a Chef nodem, on which we can apply additional recipes.

knife node list

This is just an example of how Chef with knife-Oktawave module can improve the work of the instances. More examples and information can be found in the Chef software documentation at: and  knife-Oktawave repository:

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.