How to issue SSL certificate with Subject Alternate Names for private chef server

I was trying to migrate a private chef server from ubuntu 12.04 to ubuntu 14.04 . I thought that it would be great to use Alternate Names in the certificate that I would be issuing. The certificate would be self signed but one of the issues I have faced was that ssl verification failed from the client and as reported by knife ssl check.

Continue reading


Issue with vagrant-berkshelf plugin and upgrading chefdk

As I mentioned in previous posts I have been using vagrant to develop and test chef cookbooks. A couple of days ago I have upgraded chefdk from version 0.8.0 to 0.9.0 which also upgrades berkshelf from version 3.3.0 to 4.0.1 . So when I tried to launch a vagrant box as usual with executing

Continue reading

Installing knife ec2 plugin on chefdk

Today I decided to test the chef development kit. Chef released chefdk 0.3.6 version on 2015/01/20. Till now I used to install and upgrade chef manually installing all required gems. What I found out is that knife ec2 plugin is not bundled with chefdk so you ‘ll have to install it yourself which is not very difficult. You only need to execute the following command

 $ /opt/chefdk/embedded/bin/gem install knife-ec2 

Executing MySQL load data once on chef using tags

Recently I have been trying to cut off expanses in one of the projects I ve been working. So we decided to move two of the t1.micro ec2 AWS instances to our dedicated server,which was already hosting VMS for other projects, as one KVM guest. First instance was the production MySQL DB server for the project while the other was the webserver(apache) hosting our php application. I thought it would be great to have the whole migration automated with chef in case we need to migrate later back to AWS or to another dedicated server.

Continue reading

How to set memcached CACHESIZE via chef based on node’s memory

Let’s say you wish to set the memcached CACHESIZE variable based on your system’s(node) memory.
By default CACHESIZE is defined as 64MB. You get the nodes total memory using the node[‘memory’][‘total’] which will return the memory in KB for example 1019492kB In this case you need to divide it with 1024 to get the size in MB. If you want to assign 10% of your total memory to memcached CACHESIZE then you ll have 1019492kB * 0.1 / 1024 = 99.559MB. You can remove the .559 using ruby’s to_i method.

So you can put the following in your cookbook to set your memcached cachesize. The only dependency is opscode memcached cookbook

node.set['memcached']['memory'] = (node['memory']['total'].to_i * 0.1 / 1024).to_i
include_recipe 'memcached'