2016-02-28 23:16:11 +00:00
|
|
|
require "open-uri"
|
2015-02-13 01:34:09 +00:00
|
|
|
|
2015-02-03 19:15:56 +00:00
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
|
|
|
|
config.ssh.insert_key = false
|
2013-09-27 10:45:55 +00:00
|
|
|
|
|
|
|
[:app].each_with_index do |role, i|
|
2016-02-28 23:14:50 +00:00
|
|
|
config.vm.define(role, :primary => true) do |primary|
|
2015-08-14 21:21:34 +00:00
|
|
|
primary.vm.define role
|
2016-02-28 23:16:11 +00:00
|
|
|
primary.vm.box = "hashicorp/precise64"
|
2016-02-28 23:14:50 +00:00
|
|
|
primary.vm.network "forwarded_port", :guest => 22, :host => "222#{i}".to_i
|
2016-02-28 23:16:11 +00:00
|
|
|
primary.vm.provision :shell, :inline => "sudo apt-get -y install git-core"
|
2015-02-13 01:34:09 +00:00
|
|
|
|
|
|
|
vagrantkey = open("https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub", "r",&:read)
|
|
|
|
|
2015-08-14 21:21:34 +00:00
|
|
|
primary.vm.provision :shell,
|
2016-02-28 23:14:50 +00:00
|
|
|
:inline => <<-INLINE
|
2015-02-13 01:34:09 +00:00
|
|
|
install -d -m 700 /root/.ssh
|
|
|
|
echo -e "#{vagrantkey}" > /root/.ssh/authorized_keys
|
|
|
|
chmod 0600 /root/.ssh/authorized_keys
|
|
|
|
INLINE
|
2013-09-27 10:45:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|