caterer 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Berksfile +3 -0
- data/Berksfile.lock +0 -0
- data/README.md +138 -2
- data/Vagrantfile +22 -0
- data/bin/cater +9 -0
- data/caterer.gemspec +5 -0
- data/cookbooks/users/recipes/default.rb +18 -0
- data/example/Caterfile +28 -10
- data/example/bootstrap.sh +3 -0
- data/knife.rb +1 -0
- data/lib/caterer/action/base.rb +10 -0
- data/lib/caterer/action/config/validate/image.rb +23 -0
- data/lib/caterer/action/config/validate/provisioner.rb +29 -0
- data/lib/caterer/action/config/validate.rb +10 -0
- data/lib/caterer/action/config.rb +7 -0
- data/lib/caterer/action/provisioner/base.rb +16 -0
- data/lib/caterer/action/provisioner/bootstrap.rb +14 -0
- data/lib/caterer/action/provisioner/cleanup.rb +14 -0
- data/lib/caterer/action/provisioner/prepare.rb +14 -0
- data/lib/caterer/action/provisioner/provision.rb +14 -0
- data/lib/caterer/action/provisioner.rb +11 -0
- data/lib/caterer/action/server/validate/ssh.rb +22 -0
- data/lib/caterer/action/server/validate.rb +9 -0
- data/lib/caterer/action/server.rb +7 -0
- data/lib/caterer/action.rb +9 -0
- data/lib/caterer/actions.rb +48 -0
- data/lib/caterer/command/base.rb +100 -0
- data/lib/caterer/command/bootstrap.rb +28 -0
- data/lib/caterer/command/provision.rb +24 -0
- data/lib/caterer/command/reboot.rb +22 -0
- data/lib/caterer/command/test.rb +9 -2
- data/lib/caterer/command/up.rb +28 -0
- data/lib/caterer/command.rb +6 -1
- data/lib/caterer/commands.rb +6 -1
- data/lib/caterer/communication/rsync.rb +14 -0
- data/lib/caterer/communication/ssh.rb +185 -0
- data/lib/caterer/communication.rb +6 -0
- data/lib/caterer/config/base.rb +24 -11
- data/lib/caterer/config/group.rb +24 -0
- data/lib/caterer/config/image.rb +20 -0
- data/lib/caterer/config/member.rb +14 -0
- data/lib/caterer/config/provision/chef_solo.rb +36 -12
- data/lib/caterer/config/provision.rb +5 -3
- data/lib/caterer/config.rb +5 -1
- data/lib/caterer/environment.rb +38 -12
- data/lib/caterer/provisioner/base.rb +19 -0
- data/lib/caterer/provisioner/chef_solo.rb +150 -0
- data/lib/caterer/provisioner.rb +6 -0
- data/lib/caterer/server.rb +102 -0
- data/lib/caterer/util/ansi_escape_code_remover.rb +34 -0
- data/lib/caterer/util/retryable.rb +25 -0
- data/lib/caterer/util.rb +6 -0
- data/lib/caterer/version.rb +1 -1
- data/lib/caterer.rb +15 -5
- data/lib/templates/provisioner/chef_solo/bootstrap.sh +87 -0
- data/lib/templates/provisioner/chef_solo/solo.erb +3 -0
- metadata +124 -3
- data/lib/caterer/config/role.rb +0 -21
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
require 'oj'
|
3
|
+
require 'multi_json'
|
4
|
+
|
5
|
+
module Caterer
|
6
|
+
module Provisioner
|
7
|
+
class ChefSolo < Base
|
8
|
+
|
9
|
+
def bootstrap(script=nil)
|
10
|
+
|
11
|
+
script ||= config_bootstrap || default_bootstrap
|
12
|
+
|
13
|
+
if not File.exists? script
|
14
|
+
server.ui.error "Script does not exist!"
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
# upload
|
19
|
+
server.ui.info "Uploading bootstrap script..."
|
20
|
+
server.ssh.upload script, "#{bootstrap_path}"
|
21
|
+
|
22
|
+
# set permissions
|
23
|
+
server.ui.info "Applying permissions..."
|
24
|
+
server.ssh.sudo "chown #{server.username} #{bootstrap_path}", :stream => true
|
25
|
+
server.ssh.sudo "chmod 777 #{bootstrap_path}", :stream => true
|
26
|
+
|
27
|
+
# run
|
28
|
+
server.ui.info "Running bootstrap script..."
|
29
|
+
server.ssh.sudo "#{bootstrap_path}", :stream => true
|
30
|
+
end
|
31
|
+
|
32
|
+
def prepare
|
33
|
+
server.ssh.sudo "mkdir -p #{base_path}", :stream => true
|
34
|
+
server.ssh.sudo "chown #{server.username} #{base_path}", :stream => true
|
35
|
+
end
|
36
|
+
|
37
|
+
def provision
|
38
|
+
|
39
|
+
# create cookbooks directory
|
40
|
+
server.ssh.sudo "mkdir -p #{cookbooks_path}", :stream => true
|
41
|
+
server.ssh.sudo "chown -R #{server.username} #{cookbooks_path}", :stream => true
|
42
|
+
|
43
|
+
# sync cookbooks
|
44
|
+
server.ui.info "Syncing cookbooks..."
|
45
|
+
@config.cookbooks_path.each do |path|
|
46
|
+
upload_directory path, cookbooks_path
|
47
|
+
end
|
48
|
+
|
49
|
+
# create roles directory
|
50
|
+
server.ssh.sudo "mkdir -p #{roles_path}", :stream => true
|
51
|
+
server.ssh.sudo "chown -R #{server.username} #{roles_path}", :stream => true
|
52
|
+
|
53
|
+
# sync roles
|
54
|
+
server.ui.info "Syncing roles..."
|
55
|
+
@config.roles_path.each do |path|
|
56
|
+
upload_directory path, roles_path
|
57
|
+
end
|
58
|
+
|
59
|
+
# create data_bags directory
|
60
|
+
server.ssh.sudo "mkdir -p #{data_bags_path}", :stream => true
|
61
|
+
server.ssh.sudo "chown -R #{server.username} #{data_bags_path}", :stream => true
|
62
|
+
|
63
|
+
# sync databags
|
64
|
+
server.ui.info "Syncing data bags..."
|
65
|
+
@config.data_bags_path.each do |path|
|
66
|
+
upload_directory path, data_bags_path
|
67
|
+
end
|
68
|
+
|
69
|
+
# create solo.rb
|
70
|
+
server.ui.info "Generating solo.rb..."
|
71
|
+
server.ssh.upload(StringIO.new(solo_content), solo_path)
|
72
|
+
|
73
|
+
# create json
|
74
|
+
server.ui.info "Generating json config..."
|
75
|
+
server.ssh.upload(StringIO.new(json_config), json_config_path)
|
76
|
+
|
77
|
+
# set permissions on everything
|
78
|
+
server.ssh.sudo "chown -R #{server.username} #{base_path}", :stream => true
|
79
|
+
|
80
|
+
# run
|
81
|
+
server.ui.info "Running chef-solo..."
|
82
|
+
server.ssh.sudo command_string, :stream => true
|
83
|
+
end
|
84
|
+
|
85
|
+
def cleanup
|
86
|
+
server.ssh.sudo "rm -rf #{base_path}", :stream => true
|
87
|
+
end
|
88
|
+
|
89
|
+
protected
|
90
|
+
|
91
|
+
def upload_directory(from, to)
|
92
|
+
if File.exists? from
|
93
|
+
unique = Digest::MD5.hexdigest(from)
|
94
|
+
server.ssh.upload from, "#{to}/#{unique}"
|
95
|
+
server.ssh.sudo "mv #{to}/#{unique}/* #{to}/", :stream => true
|
96
|
+
server.ssh.sudo "rm -rf #{to}/#{unique}", :stream => true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def base_path
|
101
|
+
"/tmp/cater-chef-solo"
|
102
|
+
end
|
103
|
+
|
104
|
+
def bootstrap_path
|
105
|
+
"#{base_path}/bootstrap"
|
106
|
+
end
|
107
|
+
|
108
|
+
def cookbooks_path
|
109
|
+
"#{base_path}/cookbooks"
|
110
|
+
end
|
111
|
+
|
112
|
+
def roles_path
|
113
|
+
"#{base_path}/roles"
|
114
|
+
end
|
115
|
+
|
116
|
+
def data_bags_path
|
117
|
+
"#{base_path}/data_bags"
|
118
|
+
end
|
119
|
+
|
120
|
+
def config_bootstrap
|
121
|
+
@config.bootstrap_script
|
122
|
+
end
|
123
|
+
|
124
|
+
def default_bootstrap
|
125
|
+
File.expand_path("../../../templates/provisioner/chef_solo/bootstrap.sh", __FILE__)
|
126
|
+
end
|
127
|
+
|
128
|
+
def solo_path
|
129
|
+
"#{base_path}/solo.rb"
|
130
|
+
end
|
131
|
+
|
132
|
+
def solo_content
|
133
|
+
Tilt.new(File.expand_path('../../../templates/provisioner/chef_solo/solo.erb', __FILE__)).render(self)
|
134
|
+
end
|
135
|
+
|
136
|
+
def json_config
|
137
|
+
MultiJson.dump(@config.json.merge({:run_list => @config.run_list}))
|
138
|
+
end
|
139
|
+
|
140
|
+
def json_config_path
|
141
|
+
"#{base_path}/config.json"
|
142
|
+
end
|
143
|
+
|
144
|
+
def command_string
|
145
|
+
"chef-solo -c #{solo_path} -j #{json_config_path}"
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'etc'
|
2
|
+
|
3
|
+
module Caterer
|
4
|
+
class Server
|
5
|
+
|
6
|
+
attr_reader :env
|
7
|
+
|
8
|
+
def initialize(env, opts=nil)
|
9
|
+
@env = env || Environment.new
|
10
|
+
@alias = opts[:alias]
|
11
|
+
@user = opts[:user]
|
12
|
+
@pass = opts[:pass]
|
13
|
+
@host = opts[:host]
|
14
|
+
@port = opts[:port]
|
15
|
+
@images = opts[:images] || []
|
16
|
+
end
|
17
|
+
|
18
|
+
def bootstrap(opts={})
|
19
|
+
if @images.length == 0
|
20
|
+
ui.error "image list is empty, nothing to do"
|
21
|
+
end
|
22
|
+
@images.each do |i|
|
23
|
+
ui.info "*** Bootstrapping image: #{i} ***"
|
24
|
+
run_action(:bootstrap, opts.merge({:image => i}))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def provision(opts={})
|
29
|
+
if @images.length == 0
|
30
|
+
ui.error "image list is empty, nothing to do"
|
31
|
+
end
|
32
|
+
@images.each do |i|
|
33
|
+
ui.info "*** Provisioning image: #{i} ***"
|
34
|
+
run_action(:provision, opts.merge({:image => i}))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def reboot(opts={})
|
39
|
+
run_action(:reboot, opts)
|
40
|
+
end
|
41
|
+
|
42
|
+
def up(opts={})
|
43
|
+
if @images.length == 0
|
44
|
+
ui.error "image list is empty, nothing to do"
|
45
|
+
end
|
46
|
+
@images.each do |i|
|
47
|
+
ui.info "*** Up'ing image: #{i} ***"
|
48
|
+
run_action(:up, opts.merge({:image => i}))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def ssh
|
53
|
+
@ssh ||= Communication::SSH.new(self)
|
54
|
+
end
|
55
|
+
|
56
|
+
def ssh_opts
|
57
|
+
{
|
58
|
+
:port => port,
|
59
|
+
:password => password
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def ui
|
64
|
+
@ui ||= begin
|
65
|
+
ui = @env.ui.dup
|
66
|
+
ui.resource = name
|
67
|
+
ui
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def name
|
72
|
+
@alias || host
|
73
|
+
end
|
74
|
+
|
75
|
+
def username
|
76
|
+
@user || Etc.getlogin
|
77
|
+
end
|
78
|
+
|
79
|
+
def password
|
80
|
+
@pass
|
81
|
+
end
|
82
|
+
|
83
|
+
def host
|
84
|
+
@host
|
85
|
+
end
|
86
|
+
|
87
|
+
def port
|
88
|
+
@port || 22
|
89
|
+
end
|
90
|
+
|
91
|
+
def run_action(name, options=nil)
|
92
|
+
options = {
|
93
|
+
:server => self,
|
94
|
+
:ui => ui,
|
95
|
+
:config => env.config
|
96
|
+
}.merge(options || {})
|
97
|
+
|
98
|
+
env.action_runner.run(name, options)
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Caterer
|
2
|
+
module Util
|
3
|
+
module ANSIEscapeCodeRemover
|
4
|
+
# Removes ANSI escape code sequences from the text and returns
|
5
|
+
# it.
|
6
|
+
#
|
7
|
+
# This removes all the ANSI escape codes listed here along with
|
8
|
+
# the escape codes for VT100 terminals:
|
9
|
+
#
|
10
|
+
# http://ascii-table.com/ansi-escape-sequences.php
|
11
|
+
def remove_ansi_escape_codes(text)
|
12
|
+
# An array of regular expressions which match various kinds
|
13
|
+
# of escape sequences. I can't think of a better single regular
|
14
|
+
# expression or any faster way to do this.
|
15
|
+
matchers = [/\e\[\d*[ABCD]/, # Matches things like \e[4D
|
16
|
+
/\e\[(\d*;)?\d*[HF]/, # Matches \e[1;2H or \e[H
|
17
|
+
/\e\[(s|u|2J|K)/, # Matches \e[s, \e[2J, etc.
|
18
|
+
/\e\[=\d*[hl]/, # Matches \e[=24h
|
19
|
+
/\e\[\?[1-9][hl]/, # Matches \e[?2h
|
20
|
+
/\e\[20[hl]/, # Matches \e[20l]
|
21
|
+
/\e[DME78H]/, # Matches \eD, \eH, etc.
|
22
|
+
/\e\[[0-2]?[JK]/, # Matches \e[0J, \e[K, etc.
|
23
|
+
]
|
24
|
+
|
25
|
+
# Take each matcher and replace it with emptiness.
|
26
|
+
matchers.each do |matcher|
|
27
|
+
text.gsub!(matcher, "")
|
28
|
+
end
|
29
|
+
|
30
|
+
text
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Caterer
|
2
|
+
module Util
|
3
|
+
module Retryable
|
4
|
+
# Retries a given block a specified number of times in the
|
5
|
+
# event the specified exception is raised. If the retries
|
6
|
+
# run out, the final exception is raised.
|
7
|
+
#
|
8
|
+
# This code is adapted slightly from the following blog post:
|
9
|
+
# http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/
|
10
|
+
def retryable(opts=nil)
|
11
|
+
opts = { :tries => 1, :on => Exception }.merge(opts || {})
|
12
|
+
|
13
|
+
begin
|
14
|
+
return yield
|
15
|
+
rescue *opts[:on]
|
16
|
+
if (opts[:tries] -= 1) > 0
|
17
|
+
sleep opts[:sleep].to_f if opts[:sleep]
|
18
|
+
retry
|
19
|
+
end
|
20
|
+
raise
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/caterer/util.rb
ADDED
data/lib/caterer/version.rb
CHANGED
data/lib/caterer.rb
CHANGED
@@ -3,13 +3,22 @@ require 'caterer/version'
|
|
3
3
|
require 'caterer/logger'
|
4
4
|
|
5
5
|
module Caterer
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
9
|
-
autoload :
|
6
|
+
autoload :Action, 'caterer/action'
|
7
|
+
autoload :Cli, 'caterer/cli'
|
8
|
+
autoload :Command, 'caterer/command'
|
9
|
+
autoload :Communication, 'caterer/communication'
|
10
|
+
autoload :Config, 'caterer/config'
|
11
|
+
autoload :Environment, 'caterer/environment'
|
12
|
+
autoload :Provisioner, 'caterer/provisioner'
|
13
|
+
autoload :Server, 'caterer/server'
|
14
|
+
autoload :Util, 'caterer/util'
|
10
15
|
|
11
16
|
extend self
|
12
17
|
|
18
|
+
def actions
|
19
|
+
@actions ||= Vli::Registry.new
|
20
|
+
end
|
21
|
+
|
13
22
|
def commands
|
14
23
|
@commands ||= Vli::Registry.new
|
15
24
|
end
|
@@ -24,4 +33,5 @@ module Caterer
|
|
24
33
|
|
25
34
|
end
|
26
35
|
|
27
|
-
require 'caterer/commands'
|
36
|
+
require 'caterer/commands'
|
37
|
+
require 'caterer/actions'
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# this script will:
|
4
|
+
# 1- detect a platform
|
5
|
+
# 2- install curl
|
6
|
+
# 3- download and run the chef-solo installer
|
7
|
+
|
8
|
+
# Check whether a command exists
|
9
|
+
exists() {
|
10
|
+
if command -v $1 &>/dev/null
|
11
|
+
then
|
12
|
+
return 0
|
13
|
+
else
|
14
|
+
return 1
|
15
|
+
fi
|
16
|
+
}
|
17
|
+
|
18
|
+
detect_platform() {
|
19
|
+
local platform=""
|
20
|
+
if [ -f "/etc/lsb-release" ];
|
21
|
+
then
|
22
|
+
platform=$(grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]')
|
23
|
+
elif [ -f "/etc/debian_version" ];
|
24
|
+
then
|
25
|
+
platform="debian"
|
26
|
+
elif [ -f "/etc/redhat-release" ];
|
27
|
+
then
|
28
|
+
platform="el"
|
29
|
+
elif [ -f "/etc/system-release" ];
|
30
|
+
then
|
31
|
+
platform=$(sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]')
|
32
|
+
# amazon is built off of fedora, so act like RHEL
|
33
|
+
if [ "$platform" = "amazon linux ami" ];
|
34
|
+
then
|
35
|
+
platform="el"
|
36
|
+
fi
|
37
|
+
# Apple OS X
|
38
|
+
elif [ -f "/usr/bin/sw_vers" ];
|
39
|
+
then
|
40
|
+
platform="mac_os_x"
|
41
|
+
elif [ -f "/etc/release" ];
|
42
|
+
then
|
43
|
+
platform="solaris2"
|
44
|
+
elif [ -f "/etc/SuSE-release" ];
|
45
|
+
then
|
46
|
+
if grep -q 'Enterprise' /etc/SuSE-release;
|
47
|
+
then
|
48
|
+
platform="sles"
|
49
|
+
else
|
50
|
+
platform="suse"
|
51
|
+
fi
|
52
|
+
fi
|
53
|
+
echo $platform
|
54
|
+
}
|
55
|
+
|
56
|
+
install_curl() {
|
57
|
+
echo "installing curl..."
|
58
|
+
case "$(detect_platform)" in
|
59
|
+
"ubuntu" )
|
60
|
+
apt-get -y install curl
|
61
|
+
;;
|
62
|
+
"debian" )
|
63
|
+
apt-get -y install curl
|
64
|
+
;;
|
65
|
+
"el" )
|
66
|
+
yum -y install curl
|
67
|
+
;;
|
68
|
+
"fedora" )
|
69
|
+
yum -y install curl
|
70
|
+
;;
|
71
|
+
"suse" )
|
72
|
+
yast -i curl
|
73
|
+
;;
|
74
|
+
"sles" )
|
75
|
+
yast -i curl
|
76
|
+
;;
|
77
|
+
*)
|
78
|
+
echo "sorry, I don't have a bootstrap for this platform"
|
79
|
+
exit 1
|
80
|
+
;;
|
81
|
+
esac
|
82
|
+
}
|
83
|
+
|
84
|
+
exists curl || install_curl
|
85
|
+
|
86
|
+
# install chef-solo
|
87
|
+
exists chef-solo || curl -L https://www.opscode.com/chef/install.sh | bash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caterer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
@@ -59,6 +59,86 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: net-ssh
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: net-scp
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: tilt
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: oj
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: multi_json
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '1.3'
|
134
|
+
type: :runtime
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '1.3'
|
62
142
|
description: Caterer is a server configuration tool that caters to your servers with
|
63
143
|
a push model, with support for chef recipes
|
64
144
|
email:
|
@@ -69,27 +149,68 @@ extensions: []
|
|
69
149
|
extra_rdoc_files: []
|
70
150
|
files:
|
71
151
|
- .gitignore
|
152
|
+
- Berksfile
|
153
|
+
- Berksfile.lock
|
72
154
|
- Gemfile
|
73
155
|
- LICENSE.txt
|
74
156
|
- README.md
|
75
157
|
- Rakefile
|
158
|
+
- Vagrantfile
|
76
159
|
- bin/cater
|
77
160
|
- caterer.gemspec
|
78
161
|
- config/default.rb
|
162
|
+
- cookbooks/users/recipes/default.rb
|
79
163
|
- example/Caterfile
|
164
|
+
- example/bootstrap.sh
|
165
|
+
- knife.rb
|
80
166
|
- lib/caterer.rb
|
167
|
+
- lib/caterer/action.rb
|
168
|
+
- lib/caterer/action/base.rb
|
169
|
+
- lib/caterer/action/config.rb
|
170
|
+
- lib/caterer/action/config/validate.rb
|
171
|
+
- lib/caterer/action/config/validate/image.rb
|
172
|
+
- lib/caterer/action/config/validate/provisioner.rb
|
173
|
+
- lib/caterer/action/provisioner.rb
|
174
|
+
- lib/caterer/action/provisioner/base.rb
|
175
|
+
- lib/caterer/action/provisioner/bootstrap.rb
|
176
|
+
- lib/caterer/action/provisioner/cleanup.rb
|
177
|
+
- lib/caterer/action/provisioner/prepare.rb
|
178
|
+
- lib/caterer/action/provisioner/provision.rb
|
179
|
+
- lib/caterer/action/server.rb
|
180
|
+
- lib/caterer/action/server/validate.rb
|
181
|
+
- lib/caterer/action/server/validate/ssh.rb
|
182
|
+
- lib/caterer/actions.rb
|
81
183
|
- lib/caterer/cli.rb
|
82
184
|
- lib/caterer/command.rb
|
185
|
+
- lib/caterer/command/base.rb
|
186
|
+
- lib/caterer/command/bootstrap.rb
|
187
|
+
- lib/caterer/command/provision.rb
|
188
|
+
- lib/caterer/command/reboot.rb
|
83
189
|
- lib/caterer/command/test.rb
|
190
|
+
- lib/caterer/command/up.rb
|
84
191
|
- lib/caterer/commands.rb
|
192
|
+
- lib/caterer/communication.rb
|
193
|
+
- lib/caterer/communication/rsync.rb
|
194
|
+
- lib/caterer/communication/ssh.rb
|
85
195
|
- lib/caterer/config.rb
|
86
196
|
- lib/caterer/config/base.rb
|
197
|
+
- lib/caterer/config/group.rb
|
198
|
+
- lib/caterer/config/image.rb
|
199
|
+
- lib/caterer/config/member.rb
|
87
200
|
- lib/caterer/config/provision.rb
|
88
201
|
- lib/caterer/config/provision/chef_solo.rb
|
89
|
-
- lib/caterer/config/role.rb
|
90
202
|
- lib/caterer/environment.rb
|
91
203
|
- lib/caterer/logger.rb
|
204
|
+
- lib/caterer/provisioner.rb
|
205
|
+
- lib/caterer/provisioner/base.rb
|
206
|
+
- lib/caterer/provisioner/chef_solo.rb
|
207
|
+
- lib/caterer/server.rb
|
208
|
+
- lib/caterer/util.rb
|
209
|
+
- lib/caterer/util/ansi_escape_code_remover.rb
|
210
|
+
- lib/caterer/util/retryable.rb
|
92
211
|
- lib/caterer/version.rb
|
212
|
+
- lib/templates/provisioner/chef_solo/bootstrap.sh
|
213
|
+
- lib/templates/provisioner/chef_solo/solo.erb
|
93
214
|
homepage: ''
|
94
215
|
licenses: []
|
95
216
|
post_install_message:
|
data/lib/caterer/config/role.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
|
3
|
-
module Caterer::Config
|
4
|
-
|
5
|
-
class Role
|
6
|
-
|
7
|
-
attr_reader :name
|
8
|
-
|
9
|
-
def initialize(name)
|
10
|
-
@name = name
|
11
|
-
end
|
12
|
-
|
13
|
-
def provision(type=nil)
|
14
|
-
return @provision if not type
|
15
|
-
@provision = "Caterer::Config::Provision::#{type.to_s.classify}".constantize.new
|
16
|
-
yield @provision if block_given?
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|