Skip to content

Commit 1f0ef7e

Browse files
committed
Merge branch 'release/v0.1.0'
2 parents aed54dc + b781ee5 commit 1f0ef7e

38 files changed

+1686
-4
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vagrant/*
2+
pkg/*
3+
Gemfile.lock
4+
test-*
5+
.yardoc/*
6+
doc/*
7+
Vagrantfile
8+
puppet/*
9+
*.gem

.rubocop.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
MethodLength:
2+
CountComments: false # count full line comments?
3+
Enabled: false
4+
5+
MethodName:
6+
EnforcedStyle: snake_case
7+
8+
AccessorMethodName:
9+
Description: Check the naming of accessor methods for get_/set_.
10+
Enabled: false
11+
12+
Encoding:
13+
Description: 'Use UTF-8 as the source file encoding.'
14+
Enabled: true
15+
16+
HashSyntax:
17+
Description: >-
18+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
19+
{ :a => 1, :b => 2 }.
20+
Enabled: false
21+
EnforcedStyle: hash_rockets
22+
23+
LineEndConcatenation:
24+
Description: 'Use \\ instead of + to concatenate two string literals at line end.'
25+
Enabled: true
26+
27+
LineLength:
28+
Description: 'Limit lines to 79 characters.'
29+
Enabled: true
30+
Max: 80
31+
32+
CyclomaticComplexity:
33+
Description: 'Avoid complex methods.'
34+
Enabled: false

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source 'http://rubygems.org'
2+
3+
gemspec
4+
5+
group :development do
6+
gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git'
7+
end

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 Fabio Rapposelli
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,90 @@
1-
# vagrant-vcenter
1+
[Vagrant](http://www.vagrantup.com) provider for VMware vCenter®
2+
=============
23

3-
Vagrant provider for VMware vCenter ®
4+
[Version 0.1.0](../../releases/tag/v0.1.0) has been released!
5+
-------------
46

5-
Please note that this is NOT PRODUCTION READY yet.
7+
Please note that this software is still Alpha/Beta quality and is not recommended for production usage.
68

7-
If you're feeling adventurous, check the ```develop``` branch.
9+
Right now a [Precise32](http://vagrant.gosddc.com/boxes/precise32-vcenter.box) is available for use, or you can roll your own as you please, make sure to install VMware tools in it.
10+
11+
Install
12+
-------------
13+
14+
Latest version can be easily installed by running the following command:
15+
16+
```vagrant plugin install vagrant-vcenter```
17+
18+
Vagrant will download all the required gems during the installation process.
19+
20+
After the install has completed a ```vagrant up --provider=vcenter``` will trigger the newly installed provider.
21+
22+
Configuration
23+
-------------
24+
25+
Here's a sample Multi-VM Vagrantfile:
26+
27+
```ruby
28+
precise32_box_url = 'http://vagrant.tsugliani.fr/precise32-vcenter.box'
29+
30+
nodes = [
31+
{ hostname: 'web-vm',
32+
box: 'precise32',
33+
box_url: precise32_box_url },
34+
{ hostname: 'ssh-vm',
35+
box: 'precise32',
36+
box_url: precise32_box_url },
37+
{ hostname: 'sql-vm',
38+
box: 'precise32',
39+
box_url: precise32_box_url },
40+
{ hostname: 'lb-vm',
41+
box: 'precise32',
42+
box_url: precise32_box_url }
43+
]
44+
45+
Vagrant.configure('2') do |config|
46+
47+
config.vm.provider :vcenter do |vcenter|
48+
vcenter.hostname = 'my.vcenter.hostname'
49+
vcenter.username = 'myUsername'
50+
vcenter.password = 'myPassword'
51+
vcenter.folder_name = 'myFolderName'
52+
vcenter.datacenter_name = 'MyDatacenterName'
53+
vcenter.computer_name = 'MyHostOrCluster'
54+
vcenter.datastore_name = 'MyDatastore'
55+
vcenter.template_folder_name = 'My/Template/Folder/Path'
56+
vcenter.network_name = 'myNetworkName'
57+
# If you want to use linked clones, set this to true
58+
vcenter.linked_clones = true
59+
end
60+
61+
# Go through nodes and configure each of them.j
62+
nodes.each do |node|
63+
config.vm.define node[:hostname] do |node_config|
64+
node_config.vm.box = node[:box]
65+
node_config.vm.hostname = node[:hostname]
66+
node_config.vm.box_url = node[:box_url]
67+
# node_config.vm.provision :puppet do |puppet|
68+
# puppet.manifests_path = 'puppet/manifests'
69+
# puppet.manifest_file = 'site.pp'
70+
# puppet.module_path = 'puppet/modules'
71+
# puppet.options = "--verbose --debug"
72+
# end
73+
end
74+
end
75+
end
76+
```
77+
78+
Contribute
79+
-------------
80+
81+
What is still missing:
82+
83+
- TEST SUITES! (working on that).
84+
- Speed, the code is definitely not optimized.
85+
- Thorough testing.
86+
- Error checking is absymal.
87+
- Some spaghetti code here and there.
88+
- Bugs, bugs and BUGS!.
89+
90+
If you're a developer and want to lend us a hand, head over to our ```develop``` branch and send us PRs!

Rakefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'rubygems'
2+
require 'bundler/setup'
3+
require 'rspec/core/rake_task'
4+
5+
# Immediately sync all stdout so that tools like buildbot can
6+
# immediately load in the output.
7+
$stdout.sync = true
8+
$stderr.sync = true
9+
10+
# Change to the y of this file.
11+
Dir.chdir(File.expand_path('../', __FILE__))
12+
13+
Bundler::GemHelper.install_tasks
14+
15+
RSpec::Core::RakeTask.new
16+
17+
task :default => 'spec'

example_box/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# vagrant-vcenter box specifications [WIP]
2+
3+
*Note that vagrant-vcenter currently supports only single VM vApp boxes*
4+
5+
BOX package should contain:
6+
7+
- `metadata.json` -- Vagrant metadata file
8+
- `<boxname>.ovf` -- OVF descriptor of the vApp.
9+
- `<boxname>.mf` -- OVF manifest file containing file hashes.
10+
- `<boxname>-disk-<#>.vmdk` -- Associated VMDK files.
11+
- `Vagrantfile`-- vagrant-vcenter default Vagrantfile
12+
13+
A [task is open](https://github.com/frapposelli/vagrant-vcenter/issues/12) for creating a veewee plugin to facilitate Box creation

example_box/Vagrantfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Vagrant::Config.run do |config|
2+
config.vm.base_mac = "<mac address>"
3+
end
4+
5+
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
6+
load include_vagrantfile if File.exist?(include_vagrantfile)

example_box/metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"provider": "vagrant-vcenter"}

lib/vagrant-vcenter.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'pathname'
2+
require 'vagrant-vcenter/plugin'
3+
4+
module VagrantPlugins
5+
# Initialize the plugin.
6+
module VCenter
7+
lib_path = Pathname.new(File.expand_path('../vagrant-vcenter', __FILE__))
8+
autoload :Action, lib_path.join('action')
9+
autoload :Errors, lib_path.join('errors')
10+
11+
# This returns the path to the source of this plugin.
12+
#
13+
# @return [Pathname]
14+
def self.source_root
15+
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)