Ansible playground with Vagrant
Vagrant makes it very easy to play with Ansible locally. This article provides essential information about that process to get you started in no time.
brew cask install vagrant
Let's start by generating
Since Vagrant 1.3, Ansible provisioner is built-in. Adjust
specifying a playbook file to use as an entry point.
Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision :ansible, :playbook => "playbook.yml" end
You can check Vagrant's Ansible Provisioner documentation for details, e.g. how to specify an inventory file or pass execution parameters.
playbook.yml in the same directory as
--- - hosts: all sudo: yes tasks: - name: install cURL apt: pkg=curl state=installed
vagrant up to start and provision the box. Once you changed the
playbook and your box is still running, you can simply
vagrant provision to
apply those changes.