Strollers configuration configuration

TL DR; Can someone help me understand the difference between these "names" defined in Vagrantfile?

  • config.vm.define "worker"
  • box.vm.box = "ots-box"
  • box.vm.host_name = "worker"
  • vb.name = "barhost"

When I tried to change the hostname of the stray instance that I had, I got lost in the Vagrantfile syntax. Now I have successfully changed the host name, but some other things (network) are not working. I suspect that I changed what caused the tramp to configure the window - this is a special way that caused this problem.

Vagrant.configure("2") do |config|
  config.vm.define "worker".to_sym do |box|
    box.vm.box = "ots-box"
    box.vm.box_url = "http://testing.xxx.com.s3.amazonaws.com/ots-fe.box"
    box.vm.host_name = "worker"
end

I suppose that doesn't matter, but I'm trying to create an ubuntu box on a Mac El-capitan with Oracle VirtualBox and a roaming version 1.7.4.


: config.vm.box - , . HashiCorp Atlas.

vb.name:

Vagrant.configure('2') do |config|
  config.vm.box = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
  config.vm.define "foohost" do |foohost|
  end
  config.vm.provider :virtualbox do |vb|
      vb.name = "barhost"
  end
end
+4
1

:

Vagrant.configure("2") do |config|   
  config.vm.define "worker".to_sym do |box|
    box.vm.box = "ots-box"
    box.vm.box_url = "http://testing.xxx.com.s3.amazonaws.com/ots-fe.box"
    box.vm.host_name = "worker" 
  end

, (https://docs.vagrantup.com/v2/multi-machine/), case worker, worker VM Ruby , (box)

, Vagrantfile, ,

Vagrant.configure("2") do |config|   
    config.vm.box = "ots-box"
    config.vm.box_url = "http://testing.xxx.com.s3.amazonaws.com/ots-fe.box"
    config.vm.hostname = "worker" 
  end

-, config/box.vm.box Vagrant, , , . ( , http://www.vagrantbox.es/) . , , vagrant box list. , Vagrantfile, , ( - ubuntu/trusty64, , https://atlas.hashicorp.com/ubuntu/boxes/trusty64, )

-, config/box.vm.hostname ( hostname vs host_name), doc

config.vm.hostname - , . . nil, Vagrant . , .

, Vagrantfile , hostname ubuntu . , Vagrantfile

Vagrant.configure(2) do |config|
  ...
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "ubuntu"
  ...

vm,

fhenri@machine:~/project/examples/vagrant/ubuntu$ vagrant ssh
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Tue Jan  5 10:21:54 2016 from 172.16.42.1
vagrant@ubuntu:~$ hostname
ubuntu

, config/box.vm.name ( VirtualBox), answer

+4

Source: https://habr.com/ru/post/1623309/


All Articles