boxgrinder-esx-delivery-plugin 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +20 -0
- data/README.md +52 -0
- data/Rakefile +30 -0
- data/lib/esx-delivery-plugin.rb +54 -0
- metadata +73 -0
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Sergio Rubio <rubiojr@frameos.org>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Boxgrinder ESX Delivery Plugin
|
|
2
|
+
|
|
3
|
+
Deliver appliances to VMWare ESX hypervisors
|
|
4
|
+
|
|
5
|
+
# Pre-requisites
|
|
6
|
+
|
|
7
|
+
* Boxgrinder
|
|
8
|
+
* VMWare ESX/ESXi hypervisor with SSH service enabled
|
|
9
|
+
|
|
10
|
+
# Install
|
|
11
|
+
|
|
12
|
+
$ gem install --no-ri --no-rdoc boxgrinder-esx-delivery-plugin
|
|
13
|
+
|
|
14
|
+
# Usage
|
|
15
|
+
|
|
16
|
+
$ boxgrinder-build -l esx-delivery-plugin \
|
|
17
|
+
-p vmware --platform-config type:personal,thin_disk:true \
|
|
18
|
+
-d esx --delivery-config esx_host:esx-test-host,esx_user:root,esx_password:secret \
|
|
19
|
+
my-appliance.appl
|
|
20
|
+
|
|
21
|
+
Boxgrinder will build the appliance, convert the appliance disk image to
|
|
22
|
+
a suitable VMDK variant and the resulting VMDK will be uploaded to the ESX host via SSH
|
|
23
|
+
and used to creat a virtual machine in that ESX host.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
#ESX delivery plugin configuration parameters
|
|
27
|
+
|
|
28
|
+
The ESX Boxgrinder delivery plugin accepts the following list of config parameters:
|
|
29
|
+
|
|
30
|
+
**esx_host:** the ESX hostname/ipaddress. Default is 127.0.0.1.
|
|
31
|
+
|
|
32
|
+
**esx_user:** the ESX user to use. Default is root.
|
|
33
|
+
|
|
34
|
+
**esx_password:** the ESX password to use. Default is secret.
|
|
35
|
+
|
|
36
|
+
**datastore:** the ESX datastore to use. Default is datastore1.
|
|
37
|
+
|
|
38
|
+
**name:** the target virtual machine name. Default is Virtual Appliance name.
|
|
39
|
+
|
|
40
|
+
**memory:** the amount of RAM the appliance will have. Default is 512 MB.
|
|
41
|
+
|
|
42
|
+
**cpu:** the number of CPUs the appliance will have. Default 1.
|
|
43
|
+
|
|
44
|
+
All the config parameters have default values. Use the **--delivery-config** Boxgrinder parameter to configure the appliance upload to fit your needs.
|
|
45
|
+
|
|
46
|
+
Make sure you define at lease **esx_host, esx_user and esx_password** parametes to fit your needs.
|
|
47
|
+
|
|
48
|
+
# Copyright
|
|
49
|
+
|
|
50
|
+
Copyright (c) 2011 Sergio Rubio. See LICENSE.txt for
|
|
51
|
+
further details.
|
|
52
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
require 'jeweler'
|
|
5
|
+
Jeweler::Tasks.new do |gem|
|
|
6
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
7
|
+
gem.version = "0.1"
|
|
8
|
+
gem.name = "boxgrinder-esx-delivery-plugin"
|
|
9
|
+
gem.homepage = "http://github.com/rubiojr/boxgrinder-esx-delivery-plugin"
|
|
10
|
+
gem.license = "MIT"
|
|
11
|
+
gem.summary = %Q{Deliver Boxgrider appliances to VMWare ESX/ESXi}
|
|
12
|
+
gem.description = %Q{Deliver Boxgrider appliances to VMWare ESX/ESXi}
|
|
13
|
+
gem.email = "rubiojr@frameos.org"
|
|
14
|
+
gem.authors = ["Sergio Rubio"]
|
|
15
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
|
16
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
|
17
|
+
gem.add_runtime_dependency 'esx'
|
|
18
|
+
gem.add_development_dependency 'rspec', '> 1.2.3'
|
|
19
|
+
end
|
|
20
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
21
|
+
|
|
22
|
+
require 'rake/testtask'
|
|
23
|
+
Rake::TestTask.new(:test) do |test|
|
|
24
|
+
test.libs << 'lib' << 'test'
|
|
25
|
+
test.pattern = 'test/**/test_*.rb'
|
|
26
|
+
test.verbose = true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
task :default => :build
|
|
30
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'esx'
|
|
3
|
+
require 'boxgrinder-build/plugins/base-plugin'
|
|
4
|
+
|
|
5
|
+
module BoxGrinder
|
|
6
|
+
class ESXDelivery < BasePlugin
|
|
7
|
+
def validate
|
|
8
|
+
set_default_config_value('datastore', 'datastore1')
|
|
9
|
+
set_default_config_value('name', @appliance_config.name)
|
|
10
|
+
set_default_config_value('esx_user', 'root')
|
|
11
|
+
set_default_config_value('esx_password', '')
|
|
12
|
+
set_default_config_value('esx_host', '127.0.0.1')
|
|
13
|
+
set_default_config_value('cpu', '1')
|
|
14
|
+
set_default_config_value('guest_id', 'otherGuest')
|
|
15
|
+
set_default_config_value('memory', '512')
|
|
16
|
+
set_default_config_value('power_on', 'yes')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def execute
|
|
20
|
+
@log.info "Uploading #{@appliance_config.name} to ESX host #{@plugin_config['esx_host']}..."
|
|
21
|
+
|
|
22
|
+
begin
|
|
23
|
+
#TODO move to a block
|
|
24
|
+
create_vm(@previous_deliverables[:disk])
|
|
25
|
+
@log.info "Appliance #{@appliance_config.name} uploaded."
|
|
26
|
+
rescue => e
|
|
27
|
+
@log.error e
|
|
28
|
+
@log.error "An error occurred while uploading files."
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def create_vm(disk_file)
|
|
33
|
+
host = ESX::Host.connect @plugin_config['esx_host'], @plugin_config['esx_user'], @plugin_config['esx_password']
|
|
34
|
+
datastore = @plugin_config['datastore']
|
|
35
|
+
memory = @plugin_config['memory']
|
|
36
|
+
name = @appliance_config.name
|
|
37
|
+
guest_id = @plugin_config['otherGuest']
|
|
38
|
+
@log.info "Creating VM using #{File.basename(disk_file)}..."
|
|
39
|
+
|
|
40
|
+
@log.info "Uploading and converting disk..."
|
|
41
|
+
@log.debug "Creating remote dir /vmfs/volumes/#{datastore}/#{name}"
|
|
42
|
+
host.remote_command "mkdir /vmfs/volumes/#{datastore}/#{name}"
|
|
43
|
+
host.import_disk disk_file, "/vmfs/volumes/#{datastore}/#{name}/#{name}.vmdk"
|
|
44
|
+
vm = host.create_vm :vm_name => name,
|
|
45
|
+
:disk_file => "#{name}/#{name}.vmdk",
|
|
46
|
+
:datastore => datastore, :disk_type => :flat, :memory => memory,
|
|
47
|
+
:guest_id => guest_id
|
|
48
|
+
vm.power_on
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
plugin :class => BoxGrinder::ESXDelivery, :type => :delivery, :name => :esx, :full_name => "Deliver the appliance to an ESX/ESXi host"
|
metadata
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: boxgrinder-esx-delivery-plugin
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.1'
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Sergio Rubio
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2011-12-09 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: esx
|
|
16
|
+
requirement: &11398420 !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: *11398420
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: rspec
|
|
27
|
+
requirement: &11397460 !ruby/object:Gem::Requirement
|
|
28
|
+
none: false
|
|
29
|
+
requirements:
|
|
30
|
+
- - ! '>'
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.2.3
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: *11397460
|
|
36
|
+
description: Deliver Boxgrider appliances to VMWare ESX/ESXi
|
|
37
|
+
email: rubiojr@frameos.org
|
|
38
|
+
executables: []
|
|
39
|
+
extensions: []
|
|
40
|
+
extra_rdoc_files:
|
|
41
|
+
- LICENSE.txt
|
|
42
|
+
- README.md
|
|
43
|
+
files:
|
|
44
|
+
- LICENSE.txt
|
|
45
|
+
- README.md
|
|
46
|
+
- Rakefile
|
|
47
|
+
- lib/esx-delivery-plugin.rb
|
|
48
|
+
homepage: http://github.com/rubiojr/boxgrinder-esx-delivery-plugin
|
|
49
|
+
licenses:
|
|
50
|
+
- MIT
|
|
51
|
+
post_install_message:
|
|
52
|
+
rdoc_options: []
|
|
53
|
+
require_paths:
|
|
54
|
+
- lib
|
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
|
+
none: false
|
|
57
|
+
requirements:
|
|
58
|
+
- - ! '>='
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
none: false
|
|
63
|
+
requirements:
|
|
64
|
+
- - ! '>='
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '0'
|
|
67
|
+
requirements: []
|
|
68
|
+
rubyforge_project:
|
|
69
|
+
rubygems_version: 1.8.10
|
|
70
|
+
signing_key:
|
|
71
|
+
specification_version: 3
|
|
72
|
+
summary: Deliver Boxgrider appliances to VMWare ESX/ESXi
|
|
73
|
+
test_files: []
|