Ansible must be installed on the machine in addition to Vagrant (and likely Virtualbox).
Stealing from my own project documentation.
Developer installation
- Download and install Vagrant
- Download and install VirtualBox
- Install Ansible
- OSX:
brew install ansible
- Ubuntu (see below)
- OSX:
Ansible from source for Ubuntu:
apt-get update
apt-get install python-pip python-dev git -y
pip install PyYAML jinja2 paramiko
git clone https://github.com/ansible/ansible.git
cd ansible
make install
Notes on Vagrant plus Ansible
Snippets from the Vagrantfile
:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provider "virtualbox" do |v|
v.memory = 4096 # we're running Java, need more than the 512mb default
v.customize ["modifyvm", :id, "--vram", "10"] # no graphics used.
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "../provisioning/vagrant.yml"
ansible.inventory_path = "../provisioning/hosts.ini"
ansible.limit = "vagrant"
We use the following for a vagrant-inventory.ini
:
[vagrant]
192.168.111.222
And the vagrant.yml
:
- hosts: vagrant
sudo: yes
pre_tasks:
(early init tasks here)
roles:
- role1
- role2
Hope this helps.