Skip to content

vagrant-ansible-provisioner

This is a usage example of the dmotte/dockerbox Vagrant box that uses Vagrant's Ansible Provisioner.

From here on, let's assume you have put this folder in ~/myvm on your PC.

Now customize the Vagrantfile; in particular, you may want to customize the config.vm.synced_folder section. For example:

Ruby
config.vm.synced_folder "~/git", "/home/vagrant/git"

This means that the ~/git folder on your PC will be mounted to /home/vagrant/git inside the VM.

Then you may want to customize the playbook.yml file too; it contains just some examples of what you can do.

From the ~/myvm directory, run the following command to bring up your VM:

Bash
vagrant up

You can also add the following alias to your ~/.bashrc file (replacing the script path with the correct one for your case):

Bash
alias myvmssh=~/myvm/myvmssh.sh

Open a new shell window. Now you can execute stuff in your VM from any directory within your ~/git folder, using the myvmssh alias command. For example:

Bash
myvmssh docker ps -a