chef-metal-null 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c239276b87463d097f68d1c3015972b1bfa47a3
4
+ data.tar.gz: 25561cc77cd6e45cf1a5178e3a3ad5c47b9edbfb
5
+ SHA512:
6
+ metadata.gz: 4a27ff726c536c6708443161ae25f202a986628a3223ee9f77736510a3ba5d0b207cf7a9cc74781ba09439eab7f975b42a9889dd2d65715487b0a81049903aff
7
+ data.tar.gz: c50f28a5330cb6755111a116c6bb83c643d330838fe2101e2c01e19b619917f27ce7864d78a691ae2fec0ad154d0182f19ffd90028a4e3edc7ea0b54d9b46e98
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mark Harrison
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,113 @@
1
+ # chef-metal-null
2
+
3
+ This is a driver for [chef-metal](https://github.com/opscode/chef-metal) that
4
+ doesn't actually create or destroy any machines. What it does allow you to do
5
+ however is make use of the bootstrap and converge features of Chef Metal on
6
+ machines that are already created.
7
+
8
+ You can also mix and match cloud created and manually created machines while
9
+ still using chef-metal to bootstrap them.
10
+
11
+ ## Installation
12
+
13
+ Just install the gem:
14
+
15
+ $ gem install chef-metal-null
16
+
17
+ Or if you have chefdk:
18
+
19
+ $ chef gem install chef-metal-null
20
+
21
+ ## Usage
22
+
23
+ Create a recipe, such as `site.rb` with the machines you wish to converge and
24
+ the recipes or roles you wish to use:
25
+
26
+ require 'chef_metal'
27
+
28
+ with_driver 'null'
29
+
30
+ machine "mymachine.example.com" do
31
+ converge true
32
+ recipe "foo::bar"
33
+ end
34
+
35
+ And run `chef-client -z site.rb`. This will ssh to the machines, bootstrap
36
+ chef, and perform the converge step. Remove `converge true` if you only want
37
+ chef metal to perform a chef run once (e.g. if you're using this to perform
38
+ the initial bootstrap and some other mechanism will take care of future chef
39
+ runs).
40
+
41
+ ### Vagrant example
42
+
43
+ The following example will connect to a pre-existing vagrant machine (i.e. one
44
+ created outside of chef-metal). It illustrates some of the options you can
45
+ pass:
46
+
47
+ machine "vagrant" do
48
+ converge true
49
+ machine_options :username => 'vagrant',
50
+ :hostname => '127.0.0.1',
51
+ :ssh_options => {
52
+ :port => '2222',
53
+ :password => 'vagrant'
54
+ }
55
+ recipe 'test'
56
+ end
57
+
58
+ ### Options
59
+
60
+ You pass all options via `machine_options`. The following are currently
61
+ recognized:
62
+
63
+ * hostname - the hostname to connect to. If this is left out, the name of the
64
+ machine is used.
65
+ * username - the username to connect as. If this is left out, the username of
66
+ the user running chef-client is used.
67
+ * ssh_options - a hash containing other ssh options as accepted by chef-metal
68
+ and net-ssh. The list of valid options at the time of writing is:
69
+ * `:auth_methods`
70
+ * `:bind_address`
71
+ * `:compression`
72
+ * `:compression_level`
73
+ * `:config`
74
+ * `:encryption`
75
+ * `:forward_agent`
76
+ * `:hmac`
77
+ * `:host_key`
78
+ * `:keepalive`
79
+ * `:keepalive_interval`
80
+ * `:kex`
81
+ * `:keys`
82
+ * `:key_data`
83
+ * `:languages`
84
+ * `:logger`
85
+ * `:paranoid`
86
+ * `:password`
87
+ * `:port`
88
+ * `:proxy`
89
+ * `:rekey_blocks_limit`
90
+ * `:rekey_limit`
91
+ * `:rekey_packet_limit`
92
+ * `:timeout`
93
+ * `:verbose`
94
+ * `:global_known_hosts_file`
95
+ * `:user_known_hosts_file`
96
+ * `:host_key_alias`
97
+ * `:host_name`
98
+ * `:user`
99
+ * `:properties`
100
+ * `:passphrase`
101
+ * `:keys_only`
102
+ * `:max_pkt_size`
103
+ * `:max_win_size`
104
+ * `:send_env`
105
+ * `:use_agent`
106
+
107
+ ## Contributing
108
+
109
+ 1. Fork it ( http://github.com/mivok/chef-metal-null/fork )
110
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
111
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
112
+ 4. Push to the branch (`git push origin my-new-feature`)
113
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'chef_metal_null/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "chef-metal-null"
8
+ spec.version = ChefMetalNull::VERSION
9
+ spec.authors = ["Mark Harrison"]
10
+ spec.email = ["mark@mivok.net"]
11
+ spec.summary = %q{Null driver for chef-metal}
12
+ spec.description = %q{Driver for chef-metal that works on already created machines}
13
+ spec.homepage = "https://github.com/mivok/chef-metal-null"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "chef-metal", "~> 0.13"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,3 @@
1
+ require 'chef_metal_null/null_driver'
2
+
3
+ ChefMetal.register_driver_class("null", ChefMetalNull::NullDriver)
@@ -0,0 +1,2 @@
1
+ require 'chef_metal_null/version'
2
+ require 'chef_metal_null/null_driver'
@@ -0,0 +1,56 @@
1
+ require 'chef_metal/driver'
2
+ require 'chef_metal/transport/ssh'
3
+ require 'chef_metal/convergence_strategy/install_cached'
4
+ require 'chef_metal/machine/unix_machine'
5
+
6
+ # Stop machine and destroy machine are deliberately not implemented. Spinning
7
+ # down machines is not supported.
8
+
9
+ module ChefMetalNull
10
+ class NullDriver < ChefMetal::Driver
11
+ def self.from_url(url, config)
12
+ NullDriver.new(url, config)
13
+ end
14
+
15
+ def initialize(url, config)
16
+ super
17
+ end
18
+
19
+ def self.canonicalize_url(url, config)
20
+ url
21
+ end
22
+
23
+ def allocate_machine(action_handler, machine_spec, machine_options)
24
+ # Nothing to do here - the machine already exists
25
+ machine_spec.location = {
26
+ 'driver_url' => driver_url
27
+ }
28
+ end
29
+
30
+ def ready_machine(action_handler, machine_spec, machine_options)
31
+ # Again, nothing to do here - the machine is assumed to be up
32
+ machine_for(machine_spec, machine_options)
33
+ end
34
+
35
+ def connect_to_machine(machine_spec, machine_options)
36
+ machine_for(machine_spec, machine_options)
37
+ end
38
+
39
+ def machine_for(machine_spec, machine_options)
40
+ hostname = machine_options[:hostname] || machine_spec.name
41
+ username = machine_options[:username] || ENV['USER']
42
+ options = {}
43
+ if username != 'root'
44
+ options[:prefix] = 'sudo '
45
+ end
46
+ ssh_options = machine_options[:ssh_options] || {}
47
+ transport = ChefMetal::Transport::SSH.new(
48
+ hostname, username, ssh_options, options, config)
49
+ convergence_strategy = ChefMetal::ConvergenceStrategy::InstallCached.new(
50
+ machine_options[:convergence_options], config)
51
+ ChefMetal::Machine::UnixMachine.new(
52
+ machine_spec, transport, convergence_strategy)
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,3 @@
1
+ module ChefMetalNull
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef-metal-null
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark Harrison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chef-metal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Driver for chef-metal that works on already created machines
56
+ email:
57
+ - mark@mivok.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - chef-metal-null.gemspec
68
+ - lib/chef_metal/driver_init/null.rb
69
+ - lib/chef_metal_null.rb
70
+ - lib/chef_metal_null/null_driver.rb
71
+ - lib/chef_metal_null/version.rb
72
+ homepage: https://github.com/mivok/chef-metal-null
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.2.1
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Null driver for chef-metal
96
+ test_files: []
97
+ has_rdoc: