Vagrant Cookbook

Vagrant Cookbook

Erika Heidi

Language: English

Pages: 115

ISBN: 1326020153

Format: PDF / Kindle (mobi) / ePub


How many times did you hear the excuse "works on my machine"? With Vagrant, this stays in the past. Your environments will be exactly the way you want them to be, targeting specific projects for different needs. As easy as cloning a repository and running "vagrant up". This book covers from basic to advanced concepts on Vagrant, including important ProTips to improve your Vagrant projects and avoid common mistakes. The book was updated to cover the new features on Vagrant 1.5 and 1.6.

Professional Visual Studio 2012

JavaScript Unit Testing

The Bright Continent: Breaking Rules and Making Change in Modern Africa

One Billion Rising: Law, Land and the Alleviation of Global Poverty

Test Driven Development: By Example

Learning Perl (6th Edition)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Another example, this time a file resource: file { "/root/puppet.txt": ensure => 'present', content => "vagrant cookbook" } This example would create a file named puppet.txt in the /root directory, containing the string “vagrant cookbook”. For the complete list of Puppet resource types, consult the official documentation³¹. Manifests A Manifest has a collection of resources defining your tasks. ³¹http://docs.puppetlabs.com/references/latest/type.html 47 Puppet package { 'nginx': ensure =>

need to add the cookbooks we want to run: 1 2 3 4 5 6 7 8 9 10 Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.network :private_network, ip: "192.168.33.101" config.vm.provision "chef_solo" do |chef| chef.add_recipe "main" end 59 Chef 11 12 13 config.vm.synced_folder "../../testapp", "/vagrant", :nfs => true end This will run a cookbook called “main”, and our directory structure should look like this: . ├── cookbooks │ └── main │ ├── recipes │ │ └──

you destroy and create the droplet multiple times, you will probably get the same IP address each time you run Vagrant. The Host verification key will change for that IP, this will make SSH throw an error and the Ansible provision won’t run). In such case, you’ll have to remove the stored key from your known_hosts. Custom Boxes In some cases, when you need to provision complex environments, or when you can’t “afford” spending time and / or bandwidth downloading a lot of packages, building a

custom box can be a good solution. You just need to keep in mind that the packages ⁴⁵https://github.com/erikaheidi/vagrantcookbook/tree/master/provider_digitalocean Advanced Topics 83 can get outdated easily, so you’ll eventually need to update the system and rebuild the box. The easiest way for doing so is by reusing an existent base box - you can simply customize it to your needs and repackage the box using Vagrant. Creating a box from the ground is also possible, but it’s a slightly

server running Ubuntu with Nginx and PHP. It’s important to understand that these automation tools have a level of complexity that we cannot totally cover in this book; we focused on showing their practical usage as Vagrant provisioners. The quick guide will drive you through the basics so you can understand the practical examples and experiment with different provisions. ¹⁷http://www.erikaheidi.com/2014/01/24/vagrant-usage-research/ Provisioners 28 Practical Example As mentioned before, each

Download sample

Download