Last active
August 29, 2015 14:18
-
-
Save eedgar/04c6b8d03224a6d54ea7 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
private_network{"ip"=>"192.168.20.3"}/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/kernel_v2/config/vm.rb:226:in `network': wrong number of arguments (2 for 1) (ArgumentError) | |
from /home/eedgar/git/vagrant/Vagrantfile:80:in `block (4 levels) in <top (required)>' | |
from /home/eedgar/git/vagrant/Vagrantfile:77:in `each' | |
from /home/eedgar/git/vagrant/Vagrantfile:77:in `block (3 levels) in <top (required)>' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in `call' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/v2/loader.rb:37:in `load' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:103:in `block (2 levels) in load' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in `each' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:97:in `block in load' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:94:in `each' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/config/loader.rb:94:in `load' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:149:in `machine_config' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/vagrantfile.rb:45:in `machine' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:614:in `machine' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:168:in `block in with_target_vms' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:201:in `call' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:200:in `map' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/plugin/v2/command.rb:200:in `with_target_vms' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/commands/status/command.rb:20:in `execute' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/cli.rb:42:in `execute' | |
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:301:in `cli' | |
from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:174:in `<main>' |
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
--- | |
defaults: | |
domain: vagrant.edgar.loc | |
box: chef/ubuntu-14.10 | |
box_check_update: false | |
networking: | |
private_network: | |
{ip: 192.168.20.3} | |
synced_dirs: | |
- guest: ./sync | |
- host: /sync | |
- nfs: true | |
nodes: | |
client: {} | |
#client2: | |
# ip: 10.6.0.5 | |
# ports: | |
# - {guest: 5000, host: 5000} | |
# - guest: 5001 | |
# host: 5000 |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Defaults | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.require_version '>= 1.6.5' | |
# Requires | |
require 'yaml' | |
# Functions | |
def load_nodes() | |
if File.exists?(File.dirname(__FILE__)+ '/../nodes.yaml') | |
nodes_yaml_path = File.dirname(__FILE__)+ '/../nodes.yaml' | |
else | |
nodes_yaml_path = File.dirname(__FILE__)+ '/nodes.yaml' | |
end | |
nodes_cfg = YAML.load_file(nodes_yaml_path) | |
return nodes_cfg | |
end | |
def get(key, global, node) | |
node[key] || global['defaults'][key] | |
end | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
nodes_cfg = load_nodes() | |
nodes_cfg['nodes'].each do |vm_id, settings| | |
config.vm.define(vm_id) do |cfg| | |
# Skip this node if its disabled. | |
if settings.has_key?('enable') and settings['enable'] != true | |
next | |
end | |
# lookup values | |
domain = get('domain', nodes_cfg, settings) | |
box = get('box', nodes_cfg, settings) | |
box_url = get('boxurl', nodes_cfg, settings) || "" | |
box_check_update = get('box_check_update', nodes_cfg, settings) || false | |
gui = get('gui', nodes_cfg, settings) || false | |
ports = settings['ports'] || [] | |
synced_folders = nodes_cfg['defaults']['synced_folders'] || [] | |
synced_folders.concat(settings['synced_folders'] || []) | |
ports = nodes_cfg['defaults']['ports'] || [] | |
ports.concat(settings['ports'] || []) | |
n = nodes_cfg['defaults']['networking'] || [] | |
#networking.concat(settings['networking'] || []) | |
provider = get('provider', nodes_cfg, settings) | |
# Configure | |
config.vm.provider "vmware_workstation" do |v, override| | |
# Box | |
if box | |
override.vm.box = box | |
end | |
# Url | |
if box_url | |
override.vm.box_url = box_url | |
end | |
# Check the box update | |
if box_check_update | |
override.vm.box_url = box_check_update | |
end | |
# gui | |
if gui | |
override.vm.gui = gui | |
end | |
end | |
# Networking | |
n.each do |network, args| | |
print network | |
print args | |
config.vm.network network, args | |
end | |
#config.vm.provider :aws do |aws,override| | |
# override.vm.box = "dummy" | |
# aws.tags = { | |
# "Name" => "Vagrant-Phono", | |
# "Owner" => ENV['USER'], | |
# "CreatedAt" => Time.now.strftime('%Y-%m-%dT%l:%M:%S') | |
# } | |
#end | |
# config.vm.provider "docker" do |d, override| | |
# d.image = "phusion/baseimage-1410-salt" | |
# d.cmd = ["/sbin/my_init", "--enable-insecure-key"] | |
# d.has_ssh = true | |
# override.ssh.username = "root" | |
# override.ssh.private_key_path = "key/phusion.key" | |
# end | |
# Hostname | |
cfg.vm.host_name = vm_id + '.' + domain | |
# Configure Ports | |
ports.each do |port| | |
config.vm.network 'forwarded_port', guest: port['guest'], host: port['host'] | |
end | |
end | |
end | |
end | |
# config.vm.synced_folder "pki/", "/etc/salt/pki/", | |
# owner: "root", | |
# group: "root", | |
# mount_options: ["dmode=755,fmode=664"] | |
# Provisioners | |
# config.vm.provision "shell", path: "saltminion-bootstrap.sh" | |
#config.vm.provision :salt do |salt| | |
# salt.run_highstate = true | |
# salt.no_minion = true | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment