runbook 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +5 -0
  7. data/CHANGELOG.md +46 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +6 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +999 -0
  12. data/Rakefile +6 -0
  13. data/TODO.md +38 -0
  14. data/bin/console +14 -0
  15. data/bin/setup +8 -0
  16. data/exe/runbook +5 -0
  17. data/images/runbook_anatomy_diagram.png +0 -0
  18. data/images/runbook_example.gif +0 -0
  19. data/images/runbook_execution_modes.png +0 -0
  20. data/lib/hacks/ssh_kit.rb +58 -0
  21. data/lib/runbook/cli.rb +90 -0
  22. data/lib/runbook/configuration.rb +110 -0
  23. data/lib/runbook/dsl.rb +21 -0
  24. data/lib/runbook/entities/book.rb +17 -0
  25. data/lib/runbook/entities/section.rb +7 -0
  26. data/lib/runbook/entities/step.rb +7 -0
  27. data/lib/runbook/entity.rb +127 -0
  28. data/lib/runbook/errors.rb +7 -0
  29. data/lib/runbook/extensions/add.rb +13 -0
  30. data/lib/runbook/extensions/description.rb +14 -0
  31. data/lib/runbook/extensions/sections.rb +15 -0
  32. data/lib/runbook/extensions/shared_variables.rb +51 -0
  33. data/lib/runbook/extensions/ssh_config.rb +76 -0
  34. data/lib/runbook/extensions/statements.rb +26 -0
  35. data/lib/runbook/extensions/steps.rb +14 -0
  36. data/lib/runbook/extensions/tmux.rb +13 -0
  37. data/lib/runbook/helpers/format_helper.rb +11 -0
  38. data/lib/runbook/helpers/ssh_kit_helper.rb +143 -0
  39. data/lib/runbook/helpers/tmux_helper.rb +174 -0
  40. data/lib/runbook/hooks.rb +88 -0
  41. data/lib/runbook/node.rb +23 -0
  42. data/lib/runbook/run.rb +283 -0
  43. data/lib/runbook/runner.rb +64 -0
  44. data/lib/runbook/runs/ssh_kit.rb +186 -0
  45. data/lib/runbook/statement.rb +22 -0
  46. data/lib/runbook/statements/ask.rb +11 -0
  47. data/lib/runbook/statements/assert.rb +25 -0
  48. data/lib/runbook/statements/capture.rb +14 -0
  49. data/lib/runbook/statements/capture_all.rb +14 -0
  50. data/lib/runbook/statements/command.rb +11 -0
  51. data/lib/runbook/statements/confirm.rb +10 -0
  52. data/lib/runbook/statements/description.rb +9 -0
  53. data/lib/runbook/statements/download.rb +12 -0
  54. data/lib/runbook/statements/layout.rb +10 -0
  55. data/lib/runbook/statements/note.rb +10 -0
  56. data/lib/runbook/statements/notice.rb +10 -0
  57. data/lib/runbook/statements/ruby_command.rb +9 -0
  58. data/lib/runbook/statements/tmux_command.rb +11 -0
  59. data/lib/runbook/statements/upload.rb +12 -0
  60. data/lib/runbook/statements/wait.rb +10 -0
  61. data/lib/runbook/toolbox.rb +43 -0
  62. data/lib/runbook/util/repo.rb +56 -0
  63. data/lib/runbook/util/runbook.rb +25 -0
  64. data/lib/runbook/util/sticky_hash.rb +26 -0
  65. data/lib/runbook/util/stored_pose.rb +54 -0
  66. data/lib/runbook/version.rb +3 -0
  67. data/lib/runbook/view.rb +24 -0
  68. data/lib/runbook/viewer.rb +24 -0
  69. data/lib/runbook/views/markdown.rb +109 -0
  70. data/lib/runbook.rb +110 -0
  71. data/runbook.gemspec +48 -0
  72. data/samples/hooks_runbook.rb +72 -0
  73. data/samples/layout_runbook.rb +26 -0
  74. data/samples/restart_nginx.rb +26 -0
  75. data/samples/simple_runbook.rb +41 -0
  76. metadata +324 -0
@@ -0,0 +1,26 @@
1
+ Runbook.book "Restart Nginx" do
2
+ description <<-DESC
3
+ This is a simple runbook to restart nginx and verify
4
+ it starts successfully
5
+ DESC
6
+
7
+ section "Restart Nginx" do
8
+ server "app01.prod"
9
+
10
+ step "Stop Nginx" do
11
+ note "Stopping Nginx..."
12
+ command "service nginx stop"
13
+ assert %q{service nginx status | grep "not running"}
14
+ end
15
+
16
+ step { wait 5 }
17
+
18
+ step "Start Nginx" do
19
+ note "Starting Nginx..."
20
+ command "service nginx start"
21
+ assert %q{service nginx status | grep "is running"}
22
+ confirm "Nginx is taking traffic?"
23
+ notice "Make sure to report why you restarted nginx"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ require "runbook"
3
+
4
+ runbook = Runbook.book "Simple Book" do
5
+ description <<-DESC
6
+ This is a simple runbook that does stuff
7
+ DESC
8
+
9
+ section "Parent Section" do
10
+ section "First Section" do
11
+ step "Step 1" do
12
+ parallelization({strategy: :sequence})
13
+ servers "pblesi@server01.stg", "pblesi@server02.stg"
14
+ user "root"
15
+ path "/home/pblesi"
16
+ env rails_env: "development"
17
+ umask "077"
18
+
19
+ note "I like cheese"
20
+ note "I also like carrots"
21
+ command "echo I love cheese"
22
+ command "whoami"
23
+ end
24
+ end
25
+
26
+ section "Second Section" do
27
+ step "Step 1" do
28
+ notice "Some cheese is actually yellow plastic"
29
+ ruby_command do |rb_cmd, metadata|
30
+ metadata[:toolbox].output("I like cheese whiz!")
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ if __FILE__ == $0
38
+ Runbook::Runner.new(runbook).run
39
+ else
40
+ runbook
41
+ end
metadata ADDED
@@ -0,0 +1,324 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runbook
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.12.1
5
+ platform: ruby
6
+ authors:
7
+ - pblesi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 5.0.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 5.0.0.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: method_source
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.9.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.9.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: sshkit
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: '1.16'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: '1.16'
61
+ - !ruby/object:Gem::Dependency
62
+ name: sshkit-sudo
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.1.0
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.1.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: airbrussh
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.3'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: thor
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.20.0
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.20.0
103
+ - !ruby/object:Gem::Dependency
104
+ name: tty-progressbar
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.14.0
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.14.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: tty-prompt
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.16.0
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.16.0
131
+ - !ruby/object:Gem::Dependency
132
+ name: aruba
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 0.14.5
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: 0.14.5
145
+ - !ruby/object:Gem::Dependency
146
+ name: bundler
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '1.15'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '1.15'
159
+ - !ruby/object:Gem::Dependency
160
+ name: pry
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: 0.11.3
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: 0.11.3
173
+ - !ruby/object:Gem::Dependency
174
+ name: pry-byebug
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '3.6'
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '3.6'
187
+ - !ruby/object:Gem::Dependency
188
+ name: rake
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '10.0'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '10.0'
201
+ - !ruby/object:Gem::Dependency
202
+ name: rspec
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '3.0'
208
+ type: :development
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '3.0'
215
+ description: Runbook provides a DSL for specifying production operations. This DSL
216
+ is used to generate formatted runbooks as well as interactive runbooks to be executed
217
+ on the command line.
218
+ email:
219
+ - code@getbraintree.com
220
+ executables:
221
+ - runbook
222
+ extensions: []
223
+ extra_rdoc_files: []
224
+ files:
225
+ - ".gitignore"
226
+ - ".rspec"
227
+ - ".ruby-gemset"
228
+ - ".ruby-version"
229
+ - ".travis.yml"
230
+ - CHANGELOG.md
231
+ - CODE_OF_CONDUCT.md
232
+ - Gemfile
233
+ - LICENSE.txt
234
+ - README.md
235
+ - Rakefile
236
+ - TODO.md
237
+ - bin/console
238
+ - bin/setup
239
+ - exe/runbook
240
+ - images/runbook_anatomy_diagram.png
241
+ - images/runbook_example.gif
242
+ - images/runbook_execution_modes.png
243
+ - lib/hacks/ssh_kit.rb
244
+ - lib/runbook.rb
245
+ - lib/runbook/cli.rb
246
+ - lib/runbook/configuration.rb
247
+ - lib/runbook/dsl.rb
248
+ - lib/runbook/entities/book.rb
249
+ - lib/runbook/entities/section.rb
250
+ - lib/runbook/entities/step.rb
251
+ - lib/runbook/entity.rb
252
+ - lib/runbook/errors.rb
253
+ - lib/runbook/extensions/add.rb
254
+ - lib/runbook/extensions/description.rb
255
+ - lib/runbook/extensions/sections.rb
256
+ - lib/runbook/extensions/shared_variables.rb
257
+ - lib/runbook/extensions/ssh_config.rb
258
+ - lib/runbook/extensions/statements.rb
259
+ - lib/runbook/extensions/steps.rb
260
+ - lib/runbook/extensions/tmux.rb
261
+ - lib/runbook/helpers/format_helper.rb
262
+ - lib/runbook/helpers/ssh_kit_helper.rb
263
+ - lib/runbook/helpers/tmux_helper.rb
264
+ - lib/runbook/hooks.rb
265
+ - lib/runbook/node.rb
266
+ - lib/runbook/run.rb
267
+ - lib/runbook/runner.rb
268
+ - lib/runbook/runs/ssh_kit.rb
269
+ - lib/runbook/statement.rb
270
+ - lib/runbook/statements/ask.rb
271
+ - lib/runbook/statements/assert.rb
272
+ - lib/runbook/statements/capture.rb
273
+ - lib/runbook/statements/capture_all.rb
274
+ - lib/runbook/statements/command.rb
275
+ - lib/runbook/statements/confirm.rb
276
+ - lib/runbook/statements/description.rb
277
+ - lib/runbook/statements/download.rb
278
+ - lib/runbook/statements/layout.rb
279
+ - lib/runbook/statements/note.rb
280
+ - lib/runbook/statements/notice.rb
281
+ - lib/runbook/statements/ruby_command.rb
282
+ - lib/runbook/statements/tmux_command.rb
283
+ - lib/runbook/statements/upload.rb
284
+ - lib/runbook/statements/wait.rb
285
+ - lib/runbook/toolbox.rb
286
+ - lib/runbook/util/repo.rb
287
+ - lib/runbook/util/runbook.rb
288
+ - lib/runbook/util/sticky_hash.rb
289
+ - lib/runbook/util/stored_pose.rb
290
+ - lib/runbook/version.rb
291
+ - lib/runbook/view.rb
292
+ - lib/runbook/viewer.rb
293
+ - lib/runbook/views/markdown.rb
294
+ - runbook.gemspec
295
+ - samples/hooks_runbook.rb
296
+ - samples/layout_runbook.rb
297
+ - samples/restart_nginx.rb
298
+ - samples/simple_runbook.rb
299
+ homepage: https://github.com/braintree/runbook/
300
+ licenses:
301
+ - MIT
302
+ metadata:
303
+ allowed_push_host: https://rubygems.org/
304
+ post_install_message:
305
+ rdoc_options: []
306
+ require_paths:
307
+ - lib
308
+ required_ruby_version: !ruby/object:Gem::Requirement
309
+ requirements:
310
+ - - ">="
311
+ - !ruby/object:Gem::Version
312
+ version: '0'
313
+ required_rubygems_version: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - ">="
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
318
+ requirements: []
319
+ rubyforge_project:
320
+ rubygems_version: 2.7.8
321
+ signing_key:
322
+ specification_version: 4
323
+ summary: Write beautiful, executable runbooks for conducting production operations.
324
+ test_files: []