In this tutorial I will speak about Vagrant names. You will learn how to change the name of different parts of you Vagrant project, such as provisioner name, script provisioner name, virtual machine name, the VM name that appears inside of VirtualBox GUI and the VM hostname.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# Vagrant Names # Open Oracle VM VirtualBox Manager cd ~/vagrant/ubuntu-trusty32/ # In order to avoid problems during this tutorial I will use vagrant destroy -f vagrant up --provider virtualbox # instead of "vagrant reload" vagrant status vi Vagrantfile Vagrant.configure(2) do |config| # 1 # Set provisioner name to "liviubalan.com-provisioner" # Vagrant CLI: ==> default: Running provisioner: liviubalan.com-provisioner (shell)... config.vm.provision "liviubalan.com-provisioner", type: "shell" do |s| # 2 # This value will be displayed in the output so that identification by the user is easier # when many shell provisioners are present # Vagrant CLI: default: Running: script: liviubalan.com-script s.name = "liviubalan.com-script" end # 3 # This is used to define a VM in a multi-VM environment # Vagrant CLI: Bringing machine 'liviubalan.com-VM' up with 'virtualbox' provider... # See: vagrant status config.vm.define "liviubalan.com-VM" do |http| end # 4 config.vm.provider "virtualbox" do |vb| # Customize the name that appears in the VirtualBox GUI # See: Oracle VM VirtualBox Manager vb.name = "liviubalan.com-vagrant-ubuntu" end # 5 # The hostname the machine should have # See: vagrant ssh config.vm.hostname = "UbuntuVM" end # Useful links https://docs.vagrantup.com/v2/virtualbox/configuration.html http://stackoverflow.com/questions/17845637/vagrant-default-name https://docs.vagrantup.com/v2/provisioning/basic_usage.html https://docs.vagrantup.com/v2/multi-machine/ http://friendsofvagrant.github.io/v1/docs/config/vm/define.html |
Useful links:
https://docs.vagrantup.com/v2/virtualbox/configuration.html
http://stackoverflow.com/questions/17845637/vagrant-default-name
https://docs.vagrantup.com/v2/provisioning/basic_usage.html
https://docs.vagrantup.com/v2/multi-machine/
http://friendsofvagrant.github.io/v1/docs/config/vm/define.html