serverkit 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +48 -18
- data/example/recipes/recipe.yml +4 -0
- data/lib/serverkit/recipe.rb +1 -1
- data/lib/serverkit/resources/base.rb +1 -1
- data/lib/serverkit/resources/command.rb +21 -2
- data/lib/serverkit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4c6ff6ddcad1fa170004f086a310380bbc9aea
|
4
|
+
data.tar.gz: 9e5ec0a8584f01b1478630d124a51b5675afaf5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15ef8e9c19eb85523f43c01bf70de32d5f82a57b28328a185c72a138d57454f95a0d6b41223582ae621c5c73fd62e8efefc871e5e9683b46ff1fdb20cb90539f
|
7
|
+
data.tar.gz: 7b7e70797e2b8f4fe0ce5d4301f4a741f1d8baa01db8c2a54f8bddcc2c7133ea1b86b9d92be04fc54e36efdf183bd9a594f1512acad455d90e134a3ba4ecffac
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
# Serverkit [![Build Status](https://travis-ci.org/r7kamura/serverkit.svg)](https://travis-ci.org/r7kamura/serverkit) [![Code Climate](https://codeclimate.com/github/r7kamura/serverkit/badges/gpa.svg)](https://codeclimate.com/github/r7kamura/serverkit)
|
2
2
|
Configuration management toolkit for IT automation.
|
3
3
|
|
4
|
+
- [Usage](#usage)
|
5
|
+
- [serverkit validate](#serverkit-validate)
|
6
|
+
- [serverkit inspect](#serverkit-inspect)
|
7
|
+
- [serverkit check](#serverkit-check)
|
8
|
+
- [serverkit apply](#serverkit-apply)
|
9
|
+
- [SSH support](#ssh-support)
|
10
|
+
- [Recipe](#recipe)
|
11
|
+
- [Format](#format)
|
12
|
+
- [Variables](#variables)
|
13
|
+
- [Example](#example)
|
14
|
+
- [Resource](#resource)
|
15
|
+
- [Type](#type)
|
16
|
+
- [Example](#example-1)
|
17
|
+
- [Handlers](#handlers)
|
18
|
+
- [Plug-in](#plug-in)
|
19
|
+
|
4
20
|
## Usage
|
5
21
|
Write a recipe, then run `serverkit` executable to validate, inspect, check, and apply the recipe.
|
6
22
|
|
@@ -56,12 +72,12 @@ Shows the difference between your recipe and the state of the target host.
|
|
56
72
|
|
57
73
|
```
|
58
74
|
$ serverkit check recipe.yml
|
59
|
-
[ OK ]
|
60
|
-
[ OK ]
|
61
|
-
[ OK ]
|
62
|
-
[ OK ]
|
63
|
-
[ NG ]
|
64
|
-
[ NG ]
|
75
|
+
[ OK ] homebrew mysql on localhost
|
76
|
+
[ OK ] homebrew redis on localhost
|
77
|
+
[ OK ] homebrew_cask licecap on localhost
|
78
|
+
[ OK ] homebrew_cask alfred on localhost
|
79
|
+
[ NG ] git git@github.com:r7kamura/dotfiles.git on localhost
|
80
|
+
[ NG ] symlink /Users/r7kamura/src/github.com/r7kamura/dotfiles/linked/.zshrc on localhost
|
65
81
|
```
|
66
82
|
|
67
83
|
### serverkit apply
|
@@ -69,12 +85,12 @@ Executes migration process to fill-in the gaps.
|
|
69
85
|
|
70
86
|
```
|
71
87
|
$ serverkit apply recipe.yml
|
72
|
-
[SKIP]
|
73
|
-
[SKIP]
|
74
|
-
[SKIP]
|
75
|
-
[SKIP]
|
76
|
-
[DONE]
|
77
|
-
[DONE]
|
88
|
+
[SKIP] homebrew mysql on localhost
|
89
|
+
[SKIP] homebrew redis on localhost
|
90
|
+
[SKIP] homebrew_cask licecap on localhost
|
91
|
+
[SKIP] homebrew_cask alfred on localhost
|
92
|
+
[DONE] git git@github.com:r7kamura/dotfiles.git on localhost
|
93
|
+
[DONE] symlink /Users/r7kamura/src/github.com/r7kamura/dotfiles/linked/.zshrc on localhost
|
78
94
|
```
|
79
95
|
|
80
96
|
### SSH support
|
@@ -149,7 +165,7 @@ resources:
|
|
149
165
|
A resource is a statement of configuration policy that describes the desired state for an item.
|
150
166
|
|
151
167
|
### Type
|
152
|
-
A resource must have a type
|
168
|
+
A resource must have a type attribute. Currently the following types are available:
|
153
169
|
|
154
170
|
- command
|
155
171
|
- file
|
@@ -161,8 +177,6 @@ A resource must have a type property. Currently the following types are availabl
|
|
161
177
|
- recipe
|
162
178
|
- service
|
163
179
|
- symlink
|
164
|
-
- [defaults](https://github.com/r7kamura/serverkit-defaults)
|
165
|
-
- [rbenv_ruby](https://github.com/r7kamura/serverkit-rbenv)
|
166
180
|
|
167
181
|
### Example
|
168
182
|
An example package resource that has type and name attributes.
|
@@ -174,7 +188,7 @@ resources:
|
|
174
188
|
```
|
175
189
|
|
176
190
|
## Handlers
|
177
|
-
When any changes are successfully applied to a resource and it has notify
|
191
|
+
When any changes are successfully applied to a resource and it has notify attribute,
|
178
192
|
it notifies handlers that are referenced by their id.
|
179
193
|
The notified handlers will run only once after all resources finished their applications.
|
180
194
|
Here's an example of restarting Dock on Mac OS X when its preferences change.
|
@@ -187,8 +201,7 @@ resources:
|
|
187
201
|
value: 1
|
188
202
|
notify:
|
189
203
|
- restart_dock
|
190
|
-
-
|
191
|
-
type: defaults
|
204
|
+
- type: defaults
|
192
205
|
domain: com.apple.dock
|
193
206
|
key: persistent-apps
|
194
207
|
value: []
|
@@ -199,3 +212,20 @@ handlers:
|
|
199
212
|
type: command
|
200
213
|
script: killall Dock
|
201
214
|
```
|
215
|
+
|
216
|
+
## Plug-in
|
217
|
+
A plug-in is provided as a gem.
|
218
|
+
Serverkit calls `Bundler.require(:default)` before running an action,
|
219
|
+
so you can add any behaviors to serverkit via gems defined in Gemfile.
|
220
|
+
For example, [serverkit-rbenv](https://github.com/r7kamura/serverkit-rbenv) gem
|
221
|
+
adds a custom resource type named `rbenv_ruby` by defining `Serverkit::Resources::RbenvRuby` class.
|
222
|
+
Serverkit finds `Serverkit::Resources::FooBar` resource class from `type: "foo_bar"`.
|
223
|
+
|
224
|
+
- [serverkit-defaults](https://github.com/r7kamura/serverkit-defaults)
|
225
|
+
- [serverkit-rbenv](https://github.com/r7kamura/serverkit-rbenv)
|
226
|
+
|
227
|
+
```rb
|
228
|
+
# Gemfile
|
229
|
+
gem "serverkit"
|
230
|
+
gem "serverkit-rbenv"
|
231
|
+
```
|
data/example/recipes/recipe.yml
CHANGED
data/lib/serverkit/recipe.rb
CHANGED
@@ -3,7 +3,9 @@ require "serverkit/resources/base"
|
|
3
3
|
module Serverkit
|
4
4
|
module Resources
|
5
5
|
class Command < Base
|
6
|
+
attribute :check_script, type: String
|
6
7
|
attribute :script, required: true, type: String
|
8
|
+
attribute :recheck_script, type: String
|
7
9
|
|
8
10
|
# @note Override
|
9
11
|
def apply
|
@@ -12,12 +14,29 @@ module Serverkit
|
|
12
14
|
|
13
15
|
# @note Override
|
14
16
|
def check
|
15
|
-
|
17
|
+
if check_script
|
18
|
+
check_command(check_script)
|
19
|
+
else
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def default_id
|
27
|
+
script
|
16
28
|
end
|
17
29
|
|
18
30
|
# @note Override
|
19
31
|
def recheck
|
20
|
-
|
32
|
+
case
|
33
|
+
when recheck_script
|
34
|
+
check_command(recheck_script)
|
35
|
+
when check_script
|
36
|
+
check_command(check_script)
|
37
|
+
else
|
38
|
+
true
|
39
|
+
end
|
21
40
|
end
|
22
41
|
end
|
23
42
|
end
|
data/lib/serverkit/version.rb
CHANGED