chake 0.9.1 → 0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7c5efab47798dbdf129aea6f12ef220e89d8d36
4
- data.tar.gz: 4c9b53a0d25c692ed7e2e96d607a24b19bfb5b2a
3
+ metadata.gz: f77ef7f899b9ce537667051750f06a7477a0fa79
4
+ data.tar.gz: 6a34e5a9df879a762fc76de59ee1b0d931813c03
5
5
  SHA512:
6
- metadata.gz: ab138e93a951b69c5a19a322668ef01a673095cfeb474c2733e3eaecaa7a4e0f88c1ea40238af9c51d5d102de9e1069eb841651736041ea37a78c12c065c02b9
7
- data.tar.gz: 81e6fc9f572bd42cd8e81a39e357c5f16c2a83aa7a93390adc180bb37323cda9ceb3c394a65e56721e8761a42eb7dc159e6b2cf11173e49e28469711695b9408
6
+ metadata.gz: 55237a960ac4ae67d3f0f173582b615b8306767ed16bda793828170965472356da69749b3597260e9be61ba29dd1072dd61c015fcba33e6ebc66585c7a565313
7
+ data.tar.gz: 2fcf4ef7b8edb50beb1c18b87bd5e03c30dded4477ef4e1cf3e8ac53d52454497afe3b91a17692d78cd379b37670f2688ac854ac5879b7b979b0d7190ef57a42
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.10
2
+
3
+ * Add hook functionality. See README/manpage for documentation.
4
+ * README.md: a few reviews
5
+
1
6
  # 0.9.1
2
7
 
3
8
  * fix manpage installation path
data/README.md CHANGED
@@ -77,24 +77,23 @@ host2.mycompany.com ssh
77
77
 
78
78
  ## Preparings nodes to be managed
79
79
 
80
- Nodes has very few requirements to be managed with `chake`:
80
+ Nodes have very few initial requirements to be managed with `chake`:
81
81
 
82
82
  - The node must be accessible via SSH.
83
- - The node must have `sudo` installed.
84
83
  - The user you connect to the node must either be `root`, or be allowed to run
85
- `sudo`.
84
+ `sudo` (in which case `sudo` must be installed).
86
85
 
87
86
  **A note on password prompts:** every time chake calls ssh on a node, you may
88
87
  be required to type in your password; every time chake calls sudo on the node,
89
- you may be require to type in your password. For managaing one or two nodes
90
- this is probably fine, but for larger numbers it is not practical. To avoid
88
+ you may be require to type in your password. For managing one or two nodes this
89
+ is probably fine, but for larger numbers of nodes it is not practical. To avoid
91
90
  password prompts, you can:
92
91
 
93
- - configure SSH key authentication.
94
- - this is more secure than using passwords, anyway.
95
- - bonus points: disable password authentication completely, and only allow
96
- key-based authentication
97
- - configure passwordless `sudo` access for your user on the server
92
+ - Configure SSH key-based authentication. This is more secure than using passwords.
93
+ While you are at it, you also probably want disable password authentication
94
+ completely, and only allow key-based authentication
95
+ - Configure passwordless `sudo` access for the user you use to connect to your
96
+ nodes.
98
97
 
99
98
  ## Applying cookbooks
100
99
 
@@ -147,6 +146,25 @@ the node URLs:
147
146
 
148
147
  ## Extra features
149
148
 
149
+ ### Hooks
150
+
151
+ You can define rake tasks that will be executed before bootstrapping nodes,
152
+ before uploading configuration management content to nodes, and before
153
+ converging. To do this, you just need to enhance the corresponding tasks:
154
+
155
+ * `bootstrap_common`: executed before bootstrapping nodes (even if nodes have
156
+ already been bootstrapped)
157
+ * `upload_common`: executed before uploading content to the node
158
+ * `converge_common`: executed before converging (i.e. running chef)
159
+
160
+ Example:
161
+
162
+ ```
163
+ task :bootstrap_common do
164
+ sh './scripts/pre-bootstrap-checks'
165
+ end
166
+ ```
167
+
150
168
  ### Encrypted files
151
169
 
152
170
  Any files ending matching `*.gpg` and `*.asc` will be decrypted with GnuPG
data/Rakefile CHANGED
@@ -107,6 +107,7 @@ task :check_changelog do
107
107
  end
108
108
  end
109
109
 
110
+ desc 'Makes a release'
110
111
  task :release => [:check_tag, :check_changelog, :test, 'bundler:release', :obs]
111
112
 
112
113
  task :default => :test
data/lib/chake.rb CHANGED
@@ -120,6 +120,15 @@ end
120
120
 
121
121
  bootstrap_steps = Dir.glob(File.expand_path('chake/bootstrap/*.sh', File.dirname(__FILE__))).sort
122
122
 
123
+ desc 'Executed before bootstrapping'
124
+ task :bootstrap_common
125
+
126
+ desc 'Executed before uploading'
127
+ task :upload_common
128
+
129
+ desc 'Executed before uploading'
130
+ task :converge_common
131
+
123
132
  $nodes.each do |node|
124
133
 
125
134
  hostname = node.hostname
@@ -138,7 +147,7 @@ $nodes.each do |node|
138
147
  end
139
148
 
140
149
  desc "bootstrap #{hostname}"
141
- task "bootstrap:#{hostname}" => bootstrap_script do
150
+ task "bootstrap:#{hostname}" => [:bootstrap_common, bootstrap_script] do
142
151
  config = File.join($chake_tmpdir, hostname + '.json')
143
152
 
144
153
  if File.exists?(config)
@@ -161,7 +170,7 @@ $nodes.each do |node|
161
170
  end
162
171
 
163
172
  desc "upload data to #{hostname}"
164
- task "upload:#{hostname}" do
173
+ task "upload:#{hostname}" => :upload_common do
165
174
  encrypted = encrypted_for(hostname)
166
175
  rsync_excludes = (encrypted.values + encrypted.keys).map { |f| ["--exclude", f] }.flatten
167
176
  rsync_excludes << "--exclude" << ".git/"
@@ -188,7 +197,7 @@ $nodes.each do |node|
188
197
  end
189
198
 
190
199
  desc "converge #{hostname}"
191
- task "converge:#{hostname}" => ["bootstrap:#{hostname}", "upload:#{hostname}"] do
200
+ task "converge:#{hostname}" => [:converge_common, "bootstrap:#{hostname}", "upload:#{hostname}"] do
192
201
  chef_logging = Rake.application.options.silent && '-l fatal' || ''
193
202
  node.run_as_root "chef-solo -c #{node.path}/config.rb #{chef_logging} -j #{node.path}/#{$chake_tmpdir}/#{hostname}.json"
194
203
  end
@@ -223,7 +232,7 @@ task :bootstrap => $nodes.map { |node| "bootstrap:#{node.hostname}" }
223
232
  desc "converge all nodes (default)"
224
233
  task "converge" => $nodes.map { |node| "converge:#{node.hostname}" }
225
234
 
226
- task "run a command on all nodes"
235
+ desc "run a command on all nodes"
227
236
  task :run => $nodes.map { |node| "run:#{node.hostname}" }
228
237
 
229
238
  task :default => :converge
data/lib/chake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: '0.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler