Question

I need to distribute a Vagrant file to people who already have Vagrant installed.

What I am not sure about, is whether Vagrant requires a separate installation of Ansible or whether Ansible is automatically installed together with Vagrant.

Was it helpful?

Solution

Ansible must be installed on the machine in addition to Vagrant (and likely Virtualbox).

Stealing from my own project documentation.

Developer installation

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top