The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Friday, 5 August 2011

conman: automate your server configuration

Probably you already know about Puppet and Chef and probably you felt overwhelmed when learning one of the the two server configuration management. I want to show you conman a simpler and easier approach then Puppet and Chef. Of course it has very basic features but it could be easily extended. So install conman:

gem install conman

conman has ingredients and recipes. Recipes contains ingredients. An ingredient is a class extending the Ingredient class having methods with commands. Here you can see and example of a class which can install or remove the apache2 package:

class Apache2Ingredient < Ingredient
def install
`sudo apt-get install apache2`

def remove
`sudo apt-get remove apache2`

The you can include you new ingredient in your recipe:

class MyRecipe < Recipe
apache2 :install

apache2 method search and load the Apache2Ingredient, then calls the install method. Simple!

You can run the recipe using the command line:

conman -i /path/to/ingredients /path/to/recipes/my_recipe.rb

or using Ruby:

Conman.init :ingredients => '/path/to/ingredients/' '/path/to/recipes/my_recipe.rb'

conman does not know about packages, apt-get, rpm... but I think it can be easily implemented. Another important thing that is missing is the possibility to run remotely the recipes; a SSH session using a Ruby library could do the trick (execute the command remotely).


Labels: ,


Post a Comment

Subscribe to Post Comments [Atom]

<< Home