Skip to content

Latest commit

 

History

History
107 lines (76 loc) · 2.97 KB

File metadata and controls

107 lines (76 loc) · 2.97 KB

rst

Vagrant

Basic information

Installation

You can find the Vagrant's latest version in the link https://www.vagrantup.com/ downloads.html . Also, you can install it with your package manager (check the version before install it).

Usage

Vagrant commands usually have the following structure: vagrant command [<args>] but in this particular case, we have custom options that help with our ansible configuration so the structure changes to: vagrant --custom-option=option -- command [<args>]

Note

* Be careful with the spaces between the double minus and the command. * If you use a diferent configuration for vagrant remember to delete the custom option --custom-option=option -- to use the vagrant's usual commands

  1. Use the up command alongside the --provision argument to import the VM into VirtualBox and run ansible.

    vagrant --machine=<single> -- up --provision
  2. Check if ansible ran successfully. If it didn't, find the error and patch it.
  3. Test your patch by syncing the changes and re-provision.

    vagrant --machine=<single> -- rsync
    vagrant --machine=<single> -- provision

Note

Our Vagrant's custom options are:

  • machine: Machine hostname for ansible and the playbooks's name.
  • vault-id: The password file for ansible.

Useful commands

  • ssh: Connects to machine via SSH. vagrant ssh
  • reload: Restarts vagrant machine, loads new Vagrantfile configuration. vagrant reload
  • halt: Stops the vagrant machine. vagrant halt
  • destroy: Stops and deletes all traces of the vagrant machine. vagrant destroy

For more help run vagrant -h or vagrant <command> -h for help on any individual command.

Vagrantfile

The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines1 . The syntax of Vagrantfile is Ruby.

This vagrantfile is based on a vagranfile with custom variables to ease the use of ansible_local handling and other options.

src/vagrantfile

Note

For more information about vagrantfile and how to create it go to https://www.vagrantup.com/docs/vagrantfile/

Troublehooting

vagrant-storage/index

Author

References


  1. Vagrantfile. (n.d.). Retrieved January 21, 2019, from https://www.vagrantup.com/docs/vagrantfile/