18

I'd like to ask about when and in what circumstances you'd use puppet and when you'd use chef. I've also found rump which is a puppet-solo type of thing where you iterate a single server to its configuration and then push that to a series of servers, allowing you to see changes directly.

My question: which of the above should I use and in what ways? Could someone help me?

My aim is in the context of continuous integration, continuous deployment in a mono/.Net environment with rake and git. I would like to package, version and deploy web applications easily and would like to use recepies for a load balancer for multiple web servers. Being able to take these down quickly and not have any downtime in between upgrades.

Henrik
  • 9,714
  • 5
  • 53
  • 87

5 Answers5

27

Having used both, I would say that it depends on what you look for. In my opinion:

  • Chef is more developer-oriented. If you're a Ruby guru, you'll love it.

  • Puppet is more sysadmin-oriented. It has a non-ruby DSL so it's more difficult to propagate mistakes to your machines (imho).

Puppet creates more readable and stable code but it's also slow to deploy new features. That's probably what you'll want in a big enterprise structure which strongly believes in your DevOps work.

With Chef you can achieve complex tasks with less code, time effort. You can use all the ruby magic without having to create a Puppet construct. This is good, for instance, when your Company doesn't truly believes in DevOps value and you're constantly struggling against time to prove your manager wrong :-) I personally find Puppet a bit slower to execute when you develop new features, which can be a bit of a pain.

My suggestion is: if you're a sysadmin with some development skills, go for Puppet. If you're good with Ruby (or Python), go for Chef.

I also tried rump and I'm playing with it. It helps, it's cool, but I still don't see a huge value except lazy typing of rump go instead of puppet apply -vd --modulepath=. module/manifests/init.pp. :)

Riccardo
  • 1,104
  • 13
  • 22
  • 1
    I found puppet apply + capistrano is best for local setup or in projects where you are single deployer. Otherwise security tell us to use puppet master or Hosted Chef or Chef Solo or some one else :) A lot of puppet modules written in Ruby, also i like syntax, it's easy to config, Chef is more hard. But sometimes Chef can do anything with servers where Puppet do nothing :) – merqlove Nov 08 '13 at 02:28
  • For some reason I had better luck masterless by including my class with the `-e` switch. `sudo puppet apply --modulepath ~/git/puppet_modules -e 'include my-class'` – MarkHu Mar 28 '16 at 22:24
15

I'd use Puppet but I'm kinda biased as I wrote a book about it and work there. :) In addition to Rump you can also use Puppet in its apply mode - which is the same as chef-solo. Although Rump wraps some goodness around the process that's worth trying out.

I'd give Puppet a shot here using Rump as a wrap around - you can both use the Puppet DSL OR Ruby DSL (Chef only has a Ruby DSL). It's very easy to create "environments" using Puppet and to integrate a git/CI workflow with your deployments. It's also easy to integrate with Rake tasks or the like.

James Turnbull
  • 261
  • 2
  • 2
  • Awesome. I bought your book a couple of days ago. Where should I look to get guidance about how to set up my code as packages that puppet can handle together with e.g. web servers or as stand-along services (e.g. with TopShelf)? – Henrik Jun 22 '11 at 13:35
  • The book writes like I was sitting in an enterprise with an infrastructure, dns servers, etc already set up... How do I start from scratch on win/ubuntu? Say I want to configure a Win2008 server and have a git repository? – Henrik Jun 23 '11 at 20:37
10

In the end I ended up with puppet + vagrant which allows me to run/rerun/test puppet manifests:

first install VirtualBox, then:

gem install puppet
gem install vagrant

then:

vagrant box add base http://files.vagrantup.com/lucid32.box
vagrant init

then edit ./Vagrantfile to say:

Vagrant::Config.run do |config|

  config.vm.box = "base"
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "manifests"
    puppet.module_path = "modules"
  end

  # rest here
end

then add a node definition to manifests/default.pp, like:

group { "puppet":
  ensure => "present",
}
file { '/etc/motd':
    content => "Welcome to your Vagrant-built virtual machine!\n"
}

then run:

vagrant up

Now you've got a puppet-managed virtual machine that you can play with, and any manifest that you change goes into source control. And you can iterate quickly without having to resort to rump.

Henrik
  • 9,714
  • 5
  • 53
  • 87
5

Another big difference between Puppet and Chef that hasn't been mentioned is that Puppet will do all of the manifest compilation on the Server, whereas Chef (and cfengine) will do some or all of the work on the client.

What this means is * Less CPU footprint on your client from running puppet, and * Add-in Modules written in Puppet run on the server only.

The second part is important, because it makes it much easier to integrate Puppet with your other architecture. For example, if you want to pull data via an API from another application, under Puppet you only need install the necessary API modules on the Puppetmaster, and only need to grant that one server access to the API. Any credentials necessary also remain on the puppetmaster - much more secure.

We're integrated Puppet and SecretServer (to auto-rotate root passwords using puppet and store them into SecretServer). This would not have been possible or secure under Chef, as I understand the model.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
5

If you are familiar with Ruby, I suggest you try Chef than Puppet. Using chef&ruby, you can run very complicated task. However puppet is more clean domain defined than chef. Good or not, all up to your actual work.

Huan
  • 287
  • 5
  • 12
  • What do you mean? Why is puppet more domain defined? – Henrik Nov 30 '11 at 17:03
  • I mean puppet defined more clean model than chef with more strict format. This point can make the resource(Chef call resource as recipe) easy to be read/write. – Huan Dec 01 '11 at 03:58
  • I agree. Chef recipes can be more complex then puppet manifests) – merqlove Nov 08 '13 at 02:40