---
layout: post
category: devops
title: Where we talk about ansible and chef
---
I've been using Chef for some time now, but it was always via Vagrant,
so a few weeks ago I decided to get more familiar with it. Since a
friend of mine set up a Chef server for his own use and was OK to let
me use it for my own server, I put to profit the Thanksgiving weekend
to reinstall my Linode server with it.
I'm not going to talk about installation, configuration, set up and
all that kind of stuff, there's enough blog posts, articles and books
about that subject. Instead, I will focus on my experience and share
my (very valuable) opinion (because, clearly, the world deserve to
know what I think).
## Writing cookbooks for Chef
For the few of you who don't know, cookbooks, in Chef's world, are a
group of files (templates, static files) and code to change the state
of your machine.
I've a few services on my server: git, gitolite, Jenkins, graphite,
collectd and phabricator, and I wanted a coobook for all of them.
I've started by looking for some cookbooks on the web and try to use
them without any modification. Usually, I would fetch them as a
submodule in my cookbooks repository. But for all of them, I had to
give up and import them in the repo, so I could modify them.
That's probably my biggest concern with cookbooks: I doubt code
re-usability is possible. Cookbooks should just provides LWRP
(Lightweight Resources and Providers), that's the only thing that I
can see as really re-usable.
Another annoying thing, I've not found a way to run the chef-client
with only one specific cookbook (well, I was able to, by commenting
all the cookbooks except one in my role, but that's gross).
## Using Ansible
ansible was a new tool for me. A few friends mentionned it to me last
October when I was at OSDC.fr and it was also suggested to me by a
colleague at work.
~~~~~~ description of what ansible is
It's probably less known that Chef.
~~~~~~REWORK THAT PART
With ansible you write playbooks don't write code, you only write a description in
YAML. They don't encourage to share your entire playbooks, but
instead they incite you to write modules (in Python). (you can see modules as being
similar to LWRP in Chef's world).
## Chef vs Ansible
I've decided to stick to this: use Chef for my supporting application
(nginx, MySQL, etc) and ansible for my applications.
So far, I prefer ansible to Chef. There's definitely less available
material about ansible on the net, but the quality is better, and it's
usually well organized. I've never spend more than 10 minutes looking
for something and to implement it. It can't say the same with Chef:
the wiki is confusing, there's way too many cookbooks available, their
quality is very disparate, etc.