Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
Merge branch 'network'
Browse files Browse the repository at this point in the history
  • Loading branch information
azizshamim committed Apr 12, 2013
2 parents 8a7b565 + 3c75a53 commit ba06a91
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
39 changes: 39 additions & 0 deletions README.mkd
Expand Up @@ -34,6 +34,45 @@ require 'vagrant-hitch'

Example files are in the /example directory

### Parameters

The following vagrant paramters are available in the hitch configuration:

* `vbox` - <any valid vagrant box>
* `vbox-url` - <valid box URL>
* `boot_mode` - [:headless | :gui]
* `orgname` - <organization name>
* `cpu_count` - CPU Count
* `memory_size` - RAM Amount
* `ip` - <valid IP address>
* `netmask` - <valid netmask>
* `dns` - <hostname>
* `tld` - <domain name>
* `patterns` - [/^.*mysite.dev$/, /^.*myothersite.dev$/]
* `guest` - Custom Guest Implementation
* `ports` - Custom Port Forwards
* `winrm` - WinRM configuration
* `mounts` - Custom Mounts
* `shell` - Shell Provision File
* `inline`
* `args`
* `path`
* `puppet` - Puppet Manifest Configuration
* `modules`
* `manifests_path`
* `options`
* `puppet_server` Puppet Server Configuration
* `server`
* `options`
* `chef` - Chef Configuration
* `log_level`
* `cookbooks_path`
* `roles_path`
* `data_bags_path`

#### Vagrant 1.1.x Required
* `network_mode` - [:hostonly | :private\_network | :public\_network] \(defaults to :hostonly\)

### Directory structure
The directory structure assumes:

Expand Down
4 changes: 4 additions & 0 deletions example/config/nodes.yml
Expand Up @@ -50,3 +50,7 @@ test2:
tomcat:
host: ./
guest: /opt/tomcat/webapp
test3:
<<: *default
ip: 10.10.10.11
network_mode: private_network
4 changes: 3 additions & 1 deletion lib/vagrant-hitch.rb
Expand Up @@ -56,7 +56,9 @@ def self.setup_network(profile, node_config, config)
# Configure Network
if node_config.has_key?('ip')
netmask = node_config.has_key?('netmask') ? node_config['netmask'] : '255.255.255.0'
config.vm.network :hostonly, node_config['ip'], :netmask => netmask

mode = node_config.has_key?('network_mode') ? node_config['network_mode'] : 'hostonly'
config.vm.network mode.to_sym, node_config['ip'], :netmask => netmask
end
end

Expand Down
5 changes: 5 additions & 0 deletions spec/hitch_spec.rb
Expand Up @@ -52,6 +52,7 @@
let(:vagrant_env) { ::Vagrant::Environment.new(:cwd => @tempdir) }
let(:test1) { vagrant_env.vms[:test1] }
let(:test2) { vagrant_env.vms[:test2] }
let(:test3) { vagrant_env.vms[:test3] }

it 'should configure cpu' do
test1.config.vm.customizations.should include(["modifyvm", :id, "--cpus", "2"])
Expand All @@ -69,6 +70,10 @@
test1.config.vm.networks.should include([:hostonly, ["10.10.10.10", {:netmask=>"255.255.255.0"}]])
end

it 'should configure a network' do
test3.config.vm.networks.should include([:private_network, [ "10.10.10.11", {:netmask => "255.255.255.0"}]])
end

it 'should have dns' do
pending("what does config.dns.tld and config.dns.patterns provide?")
end
Expand Down

0 comments on commit ba06a91

Please sign in to comment.