Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Some Notes On Provisioning Vagrant with Ansible

DZone's Guide to

Some Notes On Provisioning Vagrant with Ansible

· DevOps Zone
Free Resource

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

I’ve been playing with Vagrant over the last few days, using Ansible to provision it. These are some notes to remind myself for next time and are very disjointed!

Configuring Vagrant to provision using Ansible is easy enough:

  config.vm.provision "ansible" do |ansible|
      ansible.playbook = "provisioning/playbook.yml"
  end

Note however, that unlike Puppet, Ansible needs to be installed on your local computer, not within the virtual machine. On OS X, you use pip:

sudo easy_install pip
sudo pip install -U ansible

Ansible uses roles which are re-usable sets of configuration commands. The easiest way to create a new playbook is to use the ansible-galaxy command line tool:

ansible-galaxy init my_new_role

This will create a skeleton role with a main.yml in each subdirectory for you.

Ansible Galaxy is the repository for finding reusable roles. Ansible doesn’t seem to have any distribution-independence. I’m unclear if this is a problem or not, but I kept finding roles on Galaxy that were for Centos only which was annoying. Also, roles installed via the ansible-galaxy command line tool are automatically installed globally, rather than in my vagrant project. I suspect that this fits better with its main purpose of managing servers rather than being a provisioner for Vagrant.

There are useful resources that I will want to find again:

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs

Topics:

Published at DZone with permission of Rob Allen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}