Chef server prep for knife-vsphere and knife-esx vCooking – My VMware kitchen part 1

Share This:

vmware

chef

For this exercise I used latest Ubuntu 14.04.01 (even though I love rpm based system, deb does the trick on this occasion)

My servers:
kitchen.vlab.com – chef server
table.vlab.com – chef workstation

Download open source chef from: http://downloads.chef.io/

Before installation make sure you have static IP and FQDN / hostname

Install Chef server on kitchen.vlab.com:

Run to start services (may take few minutes):

Now you should be able to log into chef Web UI https://”chef-fqdn”
using: username – admin password – p@ssw0rd
you will be prompted to change the password, do so.

 

Main reference for this post is from this blog

I have noticed few bits missing and also I’ve added output for running certain commands as well as troubleshooting.

First of all you need another ubuntu server which will talk to your chef server.

Let’s install git for our chef repo and curl for client on newly installed table server (chef workstation table.vlab.com )

Following by installation of chef client:

We can retrieve Chef repository from GitHub:

This will create a directory called chef-repo in your home directory. This is where the entire configuration for your setup will be contained.

We will create a configuration directory for the Chef tools themselves within this directory:

Now we have to grab copies of private keys from chef server.

Admin
Go to Chef-server URL -> Users-> edit admin user and select tickbox next to regenerate private key.
This will bring the screen with both Public and Private key.
On the workstation server create a file:

and copy the Private key contents into this file.

Chef-validator
Go to Chef-server URL -> Clinets -> edit chef-validator and select tickbox next to private key.
This will bring the screen with both Public and Private key.
On the workstation server create a file:

and copy the Private key contents into this file.

Now we have to make sure that servers can talk to each other over SSL correctly.
If working in the lab without DNS server, place your chef-server FQDN in /etc/hosts on the workstation and vice-versa as such:

Kitchen:

Also you’ll need to copy self-sign certificate from chef-server

You can find it under: /var/opt/chef-server/nginx/ca
On chef server : (use scp to send the crt to workstation server tmp directory)

On the workstation: (created dir for certs and copy from tmp directory)

Now you should be able to configure knife – which is used for server and node communication.

Here’s the command with answers:

Few git changes worth doing after can be obtained from here:

Output looks as follows:

The hardest part of prepping Chef to be used with VMware is having right version of ruby, some gems and few other right packages.
It took my a while to get my head around those, after countless hours, here’s what worked for me.
Get the ruby and compile:

Update gems:

Install gems for ESXi and vCentre cooking:

Alchemist is required for knife-esx

So is net-scp

Get knife-esx

Get knife-vsphere:

Few extra variables setup:

Knife esx should work now. You can try list VM’s:

 

All good! Time to start some vCooking!

More post to come.
References:
http://guides.rubygems.org/command-reference/#gem-install
https://www.chef.io/solutions/vmware/
https://github.com/chef-partners/knife-vsphere
https://github.com/maintux/knife-esx
https://docs.chef.io/install_server.html

Leave a comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.