Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing a vagrant provisioner

Question

Can anyone explain why it would be better to choose the puppet or chef vagrant provisioners, rather than the shell provisioner?

Background

I'm in the process of getting started with Vagrant. One of the things I'm having trouble with is deciding which provisioner to use. So far, I've had some success using the shell provisioner, but it has been more work than I expected to get it to run reliably.

At the moment, I'm not familar with ruby, puppet or chef, but I'm happy to learn any or all of them if I have to. My early experience playing with puppet and chef is that if someone else has a recipe that does exactly what you want, it works really well, but doing something non-standard means falling back coding up solution in ruby.

I'm aware of articles comparing puppet and chef, and I'm less worried about which of them to use, rather than knowing when and why I should use them at all.

like image 993
Andrew Walker Avatar asked Oct 12 '11 22:10

Andrew Walker


People also ask

What is the Provisioner that used in vagrant by default?

Every Vagrant provisioner accepts a few base options. The only required option is what type a provisioner is: name (string) - The name of the provisioner.

What is Provisioner in vagrant?

Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.

How do I assign a provider to vagrant?

Once a provider is installed, you can use it by calling vagrant up with the --provider flag. This will force Vagrant to use that specific provider. No other configuration is necessary! In normal day-to-day usage, the --provider flag is not necessary since Vagrant can usually pick the right provider for you.

Which of following can be used as Provisioner with Vagrant select all answers that apply?

5) What is Provisioner in Vagrant? A) A provisioner is a tool to set up the virtual environment, and can be as simple as a shell script, but alternatively a more advanced tool like Chef, Puppet, or Ansible can be used.


1 Answers

Full disclosure: I'm a Puppet Labs employee. But I chose Puppet as a product over 2 years before joining them.

I would recommend that you use Puppet or Chef over shell if your configurations are going to a) have any degree of complexity and b) going to change over time - or you expect your installation environment itself to change in a way that might alter the way your deployment performs. Your scripts may be very good, but ultimately, unless you are following terrific programming practices around them, testing and QA'ing them, etc they are going to fail at some point.

There's an entire body of literate around DevOps discussing this notion, but it comes down to the principle of "technical debt" - we tend to do things the easy way now, and thus perceive them as simpler, at the cost of increasing complexity and difficulty later.

One of Puppet's strengths is its deterministic nature - the manifest you write must be able to be programmatically transformed by Puppet into a model of the server you are building. This is perceived by people as being more "difficult" but I would argue that the difficulty is lessened if you average it out along the curve of your technology's lifecycle. In other words, Puppet forces you to do your thinking now, but then deploy to scale with ease, rather than thinking later and re-engineering as you go. Pay in cash now, rather than by credit, with interest, later.

If you're purely pulling down other peoples' manifests, you're going to run into trouble at some point - although we would like it not to be so, working with Puppet today that's certainly the case, because they are writing them to address the general case, and not your particular system. Many general-purpose manifests become useful only when you reach a better understanding of Puppet.

So rather than start there, I'd work my way through the excellent Learning Puppet guide to start to grasp the basics. Puppet's learning curve is steep, but it levels off after a short while.

There are other reasons to use other provisioners or tools, but I'd surely argue that you are better with Puppet or Chef than trying to ensure that your shell scripts are doing exactly what you think they are supposed to do, for as long as you need to spawn new environments.

like image 178
eshamow Avatar answered Oct 01 '22 12:10

eshamow