我将流浪汉从1.8.1升级到1.8.4后,当我发出vagrant up命令时,只有第一台机器启动,而第二台机器只在我发出" vagrant up vmname"命令。我没有关于自动启动的任何内容,我认为两者都应该开始,但他们不... 代码如下:
Vagrant.configure(2) do |config|
config.vm.define :webserver do |webserver|
webserver.vm.box = BASE_IMAGE_NAME
webserver.vm.box_url = BASE_IMAGE_ARTIFACTORY_REF
webserver.vm.network "private_network", ip: "10.2.0.10"
webserver.vm.network "forwarded_port", guest: 80, host: 8880
webserver.vm.network "forwarded_port", guest: 443, host: 4443
webserver.vm.network "forwarded_port", guest: 8080, host: 8888
webserver.vm.synced_folder VAGRANT_SYNC_PATH, TOMCAT_INSTALL_PATH
webserver.vm.synced_folder WEBSERVER_PATH, "/srv/salt/"
webserver.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
webserver.vm.provision "shell", inline: <<-SHELL
sudo hostname web1.domain.com
SHELL
webserver.vm.provision "salt" do |salt|
salt.masterless = true
salt.minion_config = WEBSERVER_MINION_PATH
###salt.minion_config = "/srv/salt/minion"
salt.run_highstate = true
salt.colorize = true
#salt.verbose = true
end
end
config.vm.define :redis do |redis|
redis.vm.box = BASE_IMAGE_NAME
redis.vm.box_url = BASE_IMAGE_ARTIFACTORY_REF
redis.vm.network "private_network", ip: "10.2.0.20"
redis.vm.network "forwarded_port", guest: 6379, host: 6379
redis.vm.synced_folder VAGRANT_SYNC_PATH, TOMCAT_INSTALL_PATH
redis.vm.synced_folder REDIS_PATH, "/srv/salt/"
redis.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
redis.vm.provision "shell", inline: <<-SHELL
sudo hostname redis1.domain.com
SHELL
redis.vm.provision "salt" do |salt|
salt.masterless = true
salt.minion_config = REDIS_MINION_PATH
#salt.minion_config = "/srv/salt/minion"
salt.run_highstate = true
salt.colorize = true
#salt.verbose = true
end
end
end
这里是salt注释掉的输出:
C:\vagrantfiles\MOBILEWEB\WINDOWS\TOMCAT-REDIS>vagrant up
Bringing machine 'webserver' up with 'virtualbox' provider...
==> webserver: Importing base box 'vagrant-centos7-base'...
==> webserver: Matching MAC address for NAT networking...
==> webserver: Setting the name of the VM: TOMCAT-REDIS_webserver_1468231810504_5980 ==> webserver: Clearing any previously set network interfaces...
==> webserver: Preparing network interfaces based on configuration...
webserver: Adapter 1: nat
webserver: Adapter 2: hostonly
==> webserver: Forwarding ports...
webserver: 80 (guest) => 8880 (host) (adapter 1)
webserver: 443 (guest) => 4443 (host) (adapter 1)
webserver: 8080 (guest) => 8888 (host) (adapter 1)
webserver: 22 (guest) => 2222 (host) (adapter 1)
==> webserver: Running 'pre-boot' VM customizations...
==> webserver: Booting VM...
==> webserver: Waiting for machine to boot. This may take a few minutes...
webserver: SSH address: 127.0.0.1:2222
webserver: SSH username: vagrant
webserver: SSH auth method: private key
webserver: Warning: Remote connection disconnect. Retrying...
webserver: Warning: Remote connection disconnect. Retrying...
webserver: Warning: Remote connection disconnect. Retrying...
webserver:
webserver: Vagrant insecure key detected. Vagrant will automatically replace
webserver: this with a newly generated keypair for better security.
webserver:
webserver: Inserting generated public key within guest...
webserver: Removing insecure key from the guest if it's present...
webserver: Key inserted! Disconnecting and reconnecting using new SSH key...
==> webserver: Machine booted and ready!
==> webserver: Checking for guest additions in VM...
==> webserver: Configuring and enabling network interfaces...
==> webserver: Mounting shared folders...
webserver: /vagrant => C:/vagrantfiles/MOBILEWEB/WINDOWS/TOMCAT-REDIS
webserver: /srv/salt => C:/vagrantfiles/vgsalt/webserver
webserver: /opt/apache-tomcat-8.0.33/webapps => C:/vagrantsync
==> webserver: Running provisioner: shell...
webserver: Running: inline script
C:\vagrantfiles\MOBILEWEB\WINDOWS\TOMCAT-REDIS>