Shell 在多机 vagrantfile 中配置
Shell provisioning in a multi-machine vagrantfile
如何配置在多机 vagrant 文件中创建的 VM。我想在每台创建的机器上执行单独的 shell 供应脚本。我无法弄清楚流浪汉是如何促进这一点的。
$kitCoreScript = <<SCRIPT
set -e
set -x
mkdir kitCoreFolder
exit
SCRIPT
$agentScript = <<SCRIPT
set -e
set -x
mkdir agentFolder
exit
SCRIPT
Vagrant.configure(2) do |config|
config.ssh.private_key_path = "rack_rsa"
config.vm.define "kitcore" do | kitcore |
kitcore.vm.provider :rackspace do |rs|
rs.username = "username"
rs.api_key = "1232134rewf324e2qede132423"
rs.admin_password = "pass1"
rs.flavor = /1 GB Performance/
rs.image = /Ubuntu 12.04/
rs.rackspace_region = :dfw
rs.server_name = "kit-core"
rs.public_key_path = "rack_rsa.pub"
end
kitcore.provision :shell, :inline => $kitCoreScript
end
config.vm.define "agents" do |agents|
agents.vm.provider :rackspace do |rs|
rs.username = "username"
rs.api_key = "2314rwef45435342543r"
rs.admin_password = "pass1"
rs.flavor = /1 GB Performance/
rs.image = /Ubuntu 12.04/
rs.rackspace_region = :dfw
rs.server_name = "agnet"
rs.public_key_path = "rack_rsa.pub"
end
agent.provision :shell, :inline => $agentScript
end
end
显然,在 运行 上面的 vagrant 脚本中,我从 vagrant 收到了以下错误消息。
dev-setup-scripts vagrant up
There are errors in the configuration of this machine. Please fix
the following errors and try again:
Vagrant:
* Unknown configuration section 'provision'.
非常感谢任何帮助。
您需要更换:
kitcore.provision
来自
kitcore.vm.provision
对名为 agent.
的虚拟机执行相同操作
如何配置在多机 vagrant 文件中创建的 VM。我想在每台创建的机器上执行单独的 shell 供应脚本。我无法弄清楚流浪汉是如何促进这一点的。
$kitCoreScript = <<SCRIPT
set -e
set -x
mkdir kitCoreFolder
exit
SCRIPT
$agentScript = <<SCRIPT
set -e
set -x
mkdir agentFolder
exit
SCRIPT
Vagrant.configure(2) do |config|
config.ssh.private_key_path = "rack_rsa"
config.vm.define "kitcore" do | kitcore |
kitcore.vm.provider :rackspace do |rs|
rs.username = "username"
rs.api_key = "1232134rewf324e2qede132423"
rs.admin_password = "pass1"
rs.flavor = /1 GB Performance/
rs.image = /Ubuntu 12.04/
rs.rackspace_region = :dfw
rs.server_name = "kit-core"
rs.public_key_path = "rack_rsa.pub"
end
kitcore.provision :shell, :inline => $kitCoreScript
end
config.vm.define "agents" do |agents|
agents.vm.provider :rackspace do |rs|
rs.username = "username"
rs.api_key = "2314rwef45435342543r"
rs.admin_password = "pass1"
rs.flavor = /1 GB Performance/
rs.image = /Ubuntu 12.04/
rs.rackspace_region = :dfw
rs.server_name = "agnet"
rs.public_key_path = "rack_rsa.pub"
end
agent.provision :shell, :inline => $agentScript
end
end
显然,在 运行 上面的 vagrant 脚本中,我从 vagrant 收到了以下错误消息。
dev-setup-scripts vagrant up
There are errors in the configuration of this machine. Please fix
the following errors and try again:
Vagrant:
* Unknown configuration section 'provision'.
非常感谢任何帮助。
您需要更换:
kitcore.provision
来自
kitcore.vm.provision
对名为 agent.
的虚拟机执行相同操作