The simplest thing that does something Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "shell", inline: "echo Hello World!" end
1. Ansible ● Tasks, Playbooks, Roles ● Tasks are defined with YAML ● 3rd most used ● Modules Directory: Ansible Galaxy ● Requires installation of Ansible in the Host
1.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "ansible" do |ansible| ansible.playbook = "playbook.yml" end end
2. Puppet (puppet-apply) ● Resources, Manifests, Modules ● Non-sequential execution order ● Custom language based on Ruby ● 1st most used ● Modules Directory: Puppet Forge
2.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision :puppet do |puppet| puppet.module_path = "modules" end end
3. Chef (chef_solo) ● Resources, Recipes, Cookbooks ● Resources defined with Ruby ● 2nd most used, 1st with Ruby devs ● Modules Directory: Cookbooks ● Complex but very powerful
3.2 A Recipe # cookbooks/main/recipes/default.rb execute "apt-get update" do command "apt-get update" end ["nginx", "php5-fpm"].each do |p| apt_package p do action :install end end
3.4 Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision "chef_solo" do |chef| chef.add_recipe "main" end end