Skip to content

Instantly share code, notes, and snippets.

@vonnenaut
Last active July 9, 2021 12:28
Show Gist options
  • Select an option

  • Save vonnenaut/956d85fa6f0a4fdad14c3b9f0838f569 to your computer and use it in GitHub Desktop.

Select an option

Save vonnenaut/956d85fa6f0a4fdad14c3b9f0838f569 to your computer and use it in GitHub Desktop.
Vagrant

Vagrant

  • cd to dir where Vagrantfile is located before running commands
  • should place Vagrantfile within dir structure you want available inside the vm (under/vagrant dir after connecting via vagrant ssh)

Usage

  1. vagrant init [boxpath] (find box names at https://app.vagrantup.com/boxes/search)
  2. vagrant up to start vm or vagrant resume to resume suspended vm
  3. vagrant ssh connect to vm, appending <box name> to connect to a vm named in a Vagrantfile from within any directory
  • vagrant provision to force reprovisioning of vm

  • vagrant reload restart vm, loading new configuration

  • vagrant reload --provision restart vm and force reprovisioning

  • vagrant [halt|suspend] to halt or suspend a vm

  • vagrant destroy to destroy vm; append -f to skip confirmation

  • vagrant [status|global-status] to get status of vm or all vm; add --prune to remove invalid entries

  • vagrant provision --debug verbose output

  • vagrant push deploy code vagrant up --provision | tee provision.log run vagrant up, force provisioning and log all output to file

  • vagrant box list see list of all installed box images

  • vagrant box add <name> <url> download box image

  • vagrant box outdated check for updates vagrant box update

  • vagrant boxes remove <name> delete a box

  • vagrant package packages a running virtualbox env in a reusable box

  • vagrant snapshot save [options] [vm-name] <name> (vm-name is typically default) allows rollback save

Sources

https://github.com/agiledivider/vagrant-hostsupdater

https://gist.github.com/wpscholar/a49594e2e2b918f4d0c4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment