Created
July 23, 2014 21:30
-
-
Save pikeas/97a6089e430d0e372411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
coreos: | |
etcd: | |
discovery: https://discovery.etcd.io/dff4dfae541649f0d57fa928e1ba4d3c | |
addr: $public_ipv4:4001 | |
peer-addr: $public_ipv4:7001 | |
fleet: | |
public-ip: $public_ipv4 | |
units: | |
- name: etcd.service | |
command: start | |
- name: fleet.service | |
command: start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ipaddr' | |
require 'ostruct' | |
require 'yaml' | |
SETTINGS = OpenStruct.new(YAML.load_file(File.expand_path('../vagrant.yaml', __FILE__))) | |
CLOUD_CONFIG_PATH = File.expand_path('../user-data.yaml', __FILE__) | |
Vagrant.require_version '>= 1.6.0' | |
Vagrant.configure('2') do |config| | |
config.vm.box = SETTINGS.BOX | |
config.vm.box_version = SETTINGS.BOX_VERSION | |
config.vm.box_url = SETTINGS.BOX_URL | |
config.vm.provider :vmware_fusion do |vb, override| | |
override.vm.box_url = SETTINGS.BOX_VMWARE_URL | |
vb.gui = SETTINGS.GUI | |
end | |
config.vm.provider :virtualbox do |vb| | |
vb.check_guest_additions = false | |
vb.functional_vboxsf = false | |
vb.gui = SETTINGS.GUI | |
vb.memory = SETTINGS.RAM | |
vb.cpus = SETTINGS.CPUS | |
end | |
if Vagrant.has_plugin?('vagrant-vbguest') then | |
config.vbguest.auto_update = false | |
end | |
ip = IPAddr.new(SETTINGS.START_IP) | |
port = SETTINGS.DOCKER_START_PORT | |
#puts 'main loop' | |
if File.exists?(CLOUD_CONFIG_PATH) | |
config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => '/tmp/vagrantfile-user-data' | |
config.vm.provision :shell, :inline => 'mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/', :privileged => true | |
end | |
1.upto(SETTINGS.INSTANCES) do |i| | |
config.vm.define SETTINGS.NAME % i do |node| | |
#puts 'node loop' | |
if port | |
node.vm.network 'forwarded_port', guest: 2375, host: port, auto_correct: true | |
port += 1 | |
end | |
node.vm.network :private_network, ip: ip.to_s | |
ip = ip.succ | |
end | |
end | |
end | |
=begin | |
user-data | |
hostname | |
serial logging | |
config.vm.synced_folder '.', '/home/core/share', id: 'core', :nfs => true, :mount_options => ['nolock,vers=3,udp'] | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment