chake 0.9.1 → 0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +5 -0
- data/README.md +28 -10
- data/Rakefile +1 -0
- data/lib/chake.rb +13 -4
- data/lib/chake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f77ef7f899b9ce537667051750f06a7477a0fa79
|
4
|
+
data.tar.gz: 6a34e5a9df879a762fc76de59ee1b0d931813c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55237a960ac4ae67d3f0f173582b615b8306767ed16bda793828170965472356da69749b3597260e9be61ba29dd1072dd61c015fcba33e6ebc66585c7a565313
|
7
|
+
data.tar.gz: 2fcf4ef7b8edb50beb1c18b87bd5e03c30dded4477ef4e1cf3e8ac53d52454497afe3b91a17692d78cd379b37670f2688ac854ac5879b7b979b0d7190ef57a42
|
data/ChangeLog.md
CHANGED
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
|
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
|
90
|
-
|
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
|
-
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
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
|
-
|
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
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.
|
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-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|