macp-3:vagrant-aws sans$cat scripts/aws.Json{ "env": "dops","access_key": "XXXXXXXXXXXXXXXX","secret_key": "hfgy5ejfkprg2432432beqo2r","region": "eu-west-1","availability_zone": "a","subnet_ID": "subnet-0b766860","security_groups": [ "sg-53t48c34","sg-11668f7e","sg-4a6c8525","sg-75168c1e" ],"ssh_username": "ubuntu","keypair": "Xdops_testKey","ssh_private_key": "/Users/sans/.ssh/ID_rsa","ec2s": { "dops-agg-001": { "ami_ID": "ami-838675f7","instance_type": "m3.medium","elastic_ip": "ture","Tags": { "name": "dops-agg-001","Role": "sql-aggr","ServiceType": "database","nopeType": "mem_master","CostCentre": "QA" } },"dops-nag-001": { "ami_ID": "ami-838675f7","Tags": { "name": "dops-nag-001","Role": "monitoring","ServiceType": "controller","nopeType": "nagios","CostCentre": "QA" } } }}
这是我提出的Vagrantfile:
# -*- mode: ruby -*-# vi: set ft=ruby :aws_cfg = (JsON.parse(file.read("scripts/aws.Json")))Vagrant.configure("2") do |config| config.vm.Box = "dummy" config.vm.Box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.Box" aws_cfg['ec2s'].each do |node| node_name = node[0] node_value = node[1] # Node specific configuration config.vm.define node_name do |config2| ec2_Tags = node_value['Tags'] # Spining up EC2 instances config2.vm.provIDer :aws do |ec2,overrIDe| ec2.access_key_ID = aws_cfg['access_key'] ec2.secret_access_key = aws_cfg['secret_key'] ec2.keypair_name = aws_cfg['keypair'] ec2.region = aws_cfg['region'] ec2.availability_zone = aws_cfg['region']+aws_cfg['availability_zone'] ec2.subnet_ID = aws_cfg['subnet_ID'] ec2.security_groups = aws_cfg['security_groups'] # ec2.ami = node_value['ami_ID'] ec2.instance_type = node_value['instance_type'] ec2.elastic_ip = node_value['elastic_ip'] # ec2.Tags = { 'name' => ec2_Tags['name'],'Role' => ec2_Tags['Role'],'ServiceType' => ec2_Tags['ServiceType'],'nopeType' => ec2_Tags['nopeType'],'CostCentre' => ec2_Tags['CostCentre'] } # overrIDe.ssh.username = "ubuntu" overrIDe.ssh.private_key_path = "/Users/sans/.ssh/ID_rsa" end # Final Puppet provisioning #config2.vm.provision :puppet do |ppt| # ppt.options = "--verbose --deBUG" # ppt.manifests_path = "puppet/manifests" # ppt.manifest_file = "nodes.pp" # ppt.module_path = "puppet/modules" #end end endend
它工作正常,但尝试并行旋转盒子,而不是一个接一个:
macp-3:vagrant-aws sans$vagrant up --provIDer=awsBringing machine 'dops-agg-001' up with 'aws' provIDer...Bringing machine 'dops-mon-001' up with 'aws' provIDer...[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.==> dops-mon-001: HandleBoxUrl mIDdleware is deprecated. Use HandleBox instead.==> dops-mon-001: This is a BUG with the provIDer. Please contact the creator==> dops-agg-001: HandleBoxUrl mIDdleware is deprecated. Use HandleBox instead.==> dops-mon-001: of the provIDer you use to fix this.........
我相信在Vagrantfile中循环有一些问题?有人能告诉我这里会发生什么事吗?最好!
解决方法 这个问题已经是 answered in a Google Group了.解:
– [no-] parallel – 如果提供商支持,则将多台计算机并行启动.
总结以上是内存溢出为你收集整理的ruby – 使用Vagrant的多个EC2实例全部内容,希望文章能够帮你解决ruby – 使用Vagrant的多个EC2实例所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)