chake 0.21 → 0.81.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ackrc +2 -0
- data/.gitignore +22 -0
- data/.gitlab-ci.yml +24 -0
- data/.manifest +65 -0
- data/.rubocop.yml +55 -0
- data/.rubocop_todo.yml +40 -0
- data/ChangeLog.md +37 -0
- data/README.chef.md +70 -0
- data/README.itamae.md +58 -0
- data/README.md +118 -85
- data/README.shell.md +30 -0
- data/Rakefile +36 -10
- data/bin/chake +2 -2
- data/chake.gemspec +16 -16
- data/examples/test/.ssh_config +4 -0
- data/examples/test/Rakefile +1 -1
- data/examples/test/Vagrantfile +6 -0
- data/examples/test/config.rb +4 -4
- data/examples/test/cookbooks/basics/recipes/default.rb +1 -0
- data/examples/test/cookbooks/example/files/default/test +1 -0
- data/examples/test/cookbooks/example/files/{host-homer → host-lemur}/test.asc +0 -0
- data/lib/chake.rb +111 -153
- data/lib/chake/bootstrap/chef/01_installed.sh +4 -0
- data/lib/chake/bootstrap/{01_debian.sh → chef/02_debian.sh} +0 -0
- data/lib/chake/bootstrap/{99_unsupported.sh → chef/99_unsupported.sh} +0 -0
- data/lib/chake/config.rb +2 -7
- data/lib/chake/config_manager.rb +89 -0
- data/lib/chake/config_manager/chef.rb +35 -0
- data/lib/chake/config_manager/itamae.rb +57 -0
- data/lib/chake/config_manager/shell.rb +34 -0
- data/lib/chake/config_manager/skel/chef/Rakefile +1 -0
- data/lib/chake/config_manager/skel/chef/config.rb +4 -0
- data/lib/chake/config_manager/skel/chef/cookbooks/basics/recipes/default.rb +1 -0
- data/lib/chake/config_manager/skel/chef/nodes.yaml +3 -0
- data/lib/chake/config_manager/skel/itamae/Rakefile +1 -0
- data/lib/chake/config_manager/skel/itamae/cookbooks/basics/default.rb +1 -0
- data/lib/chake/config_manager/skel/itamae/nodes.yaml +3 -0
- data/lib/chake/config_manager/skel/itamae/roles/basic.rb +1 -0
- data/lib/chake/config_manager/skel/shell/Rakefile +1 -0
- data/lib/chake/config_manager/skel/shell/nodes.yaml +3 -0
- data/lib/chake/connection.rb +83 -0
- data/lib/chake/{backend → connection}/local.rb +2 -8
- data/lib/chake/{backend → connection}/ssh.rb +6 -14
- data/lib/chake/node.rb +49 -29
- data/lib/chake/readline.rb +6 -10
- data/lib/chake/version.rb +1 -1
- data/lib/chake/wipe.rb +18 -0
- data/man/.gitignore +2 -0
- data/man/Rakefile +28 -14
- data/man/readme2man.sed +5 -5
- data/spec/chake/backend/local_spec.rb +5 -6
- data/spec/chake/backend/ssh_spec.rb +8 -10
- data/spec/chake/backend_spec.rb +1 -2
- data/spec/chake/config_manager/chef_spec.rb +38 -0
- data/spec/chake/config_manager/itamae_spec.rb +87 -0
- data/spec/chake/config_manager/shell_spec.rb +54 -0
- data/spec/chake/config_manager_spec.rb +23 -0
- data/spec/chake/node_spec.rb +38 -15
- data/spec/spec_helper.rb +37 -17
- metadata +65 -39
- data/coverage/assets/0.11.0/application.css +0 -809
- data/coverage/assets/0.11.0/application.js +0 -43679
- data/coverage/assets/0.11.0/colorbox/border.png +0 -0
- data/coverage/assets/0.11.0/colorbox/controls.png +0 -0
- data/coverage/assets/0.11.0/colorbox/loading.gif +0 -0
- data/coverage/assets/0.11.0/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.11.0/favicon_green.png +0 -0
- data/coverage/assets/0.11.0/favicon_red.png +0 -0
- data/coverage/assets/0.11.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.11.0/loading.gif +0 -0
- data/coverage/assets/0.11.0/magnify.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.11.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +0 -4158
- data/lib/chake/backend.rb +0 -80
- data/tags +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f7d8d43e77083c572708161c1d1fd8e9e803327e612d29742578e2d7a82a8c1
|
4
|
+
data.tar.gz: 69e9cdc947102f920467ed87d97ddd6ddfeba718bd4ea16278c0b9ee311b4246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac1ff6a235dfd9cca99f02158970b27ec060d148b9cd40232a495fe52e78600fc2534e9f1785c9b8b4e140ea2cbd0b740eb97d130c4862a2ad6b69f397c01cc9
|
7
|
+
data.tar.gz: f158161aed2b08a02524dc0d4bd78e7133b6fdc3d61396b8e148b06bd06e78c9e5170a6bdec8c2d6a1bc856a6156c3c27977b6b89cf62ca7b5804cbacc6a8ea0
|
data/.ackrc
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
/examples/test/nodes.yaml
|
19
|
+
/examples/test/.tmp
|
20
|
+
.*.html
|
21
|
+
*.1
|
22
|
+
*.7
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
image: debian:testing
|
2
|
+
|
3
|
+
.install: &install
|
4
|
+
- apt-get update && apt-get install -qy ruby asciidoctor ruby-bundler ruby-rspec rubocop ruby-simplecov codespell ronn
|
5
|
+
|
6
|
+
tests:
|
7
|
+
before_script: *install
|
8
|
+
script:
|
9
|
+
- rake test
|
10
|
+
|
11
|
+
manpages:
|
12
|
+
before_script: *install
|
13
|
+
script:
|
14
|
+
- rake man
|
15
|
+
|
16
|
+
style:
|
17
|
+
before_script: *install
|
18
|
+
script:
|
19
|
+
- rake style
|
20
|
+
|
21
|
+
codespell:
|
22
|
+
before_script: *install
|
23
|
+
script:
|
24
|
+
- rake codespell
|
data/.manifest
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
.ackrc
|
2
|
+
.gitignore
|
3
|
+
.gitlab-ci.yml
|
4
|
+
.manifest
|
5
|
+
.rubocop.yml
|
6
|
+
.rubocop_todo.yml
|
7
|
+
ChangeLog.md
|
8
|
+
Gemfile
|
9
|
+
LICENSE.txt
|
10
|
+
README.chef.md
|
11
|
+
README.itamae.md
|
12
|
+
README.md
|
13
|
+
README.shell.md
|
14
|
+
Rakefile
|
15
|
+
bin/chake
|
16
|
+
chake.gemspec
|
17
|
+
chake.spec.erb
|
18
|
+
examples/test/.ssh_config
|
19
|
+
examples/test/Rakefile
|
20
|
+
examples/test/Vagrantfile
|
21
|
+
examples/test/config.rb
|
22
|
+
examples/test/cookbooks/basics/recipes/default.rb
|
23
|
+
examples/test/cookbooks/example/files/default/test
|
24
|
+
examples/test/cookbooks/example/files/host-lemur/test.asc
|
25
|
+
examples/test/cookbooks/example/recipes/default.rb
|
26
|
+
lib/chake.rb
|
27
|
+
lib/chake/bootstrap/00_set_hostname.sh
|
28
|
+
lib/chake/bootstrap/chef/01_installed.sh
|
29
|
+
lib/chake/bootstrap/chef/02_debian.sh
|
30
|
+
lib/chake/bootstrap/chef/99_unsupported.sh
|
31
|
+
lib/chake/config.rb
|
32
|
+
lib/chake/config_manager.rb
|
33
|
+
lib/chake/config_manager/chef.rb
|
34
|
+
lib/chake/config_manager/itamae.rb
|
35
|
+
lib/chake/config_manager/shell.rb
|
36
|
+
lib/chake/config_manager/skel/chef/Rakefile
|
37
|
+
lib/chake/config_manager/skel/chef/config.rb
|
38
|
+
lib/chake/config_manager/skel/chef/cookbooks/basics/recipes/default.rb
|
39
|
+
lib/chake/config_manager/skel/chef/nodes.yaml
|
40
|
+
lib/chake/config_manager/skel/itamae/Rakefile
|
41
|
+
lib/chake/config_manager/skel/itamae/cookbooks/basics/default.rb
|
42
|
+
lib/chake/config_manager/skel/itamae/nodes.yaml
|
43
|
+
lib/chake/config_manager/skel/itamae/roles/basic.rb
|
44
|
+
lib/chake/config_manager/skel/shell/Rakefile
|
45
|
+
lib/chake/config_manager/skel/shell/nodes.yaml
|
46
|
+
lib/chake/connection.rb
|
47
|
+
lib/chake/connection/local.rb
|
48
|
+
lib/chake/connection/ssh.rb
|
49
|
+
lib/chake/node.rb
|
50
|
+
lib/chake/readline.rb
|
51
|
+
lib/chake/tmpdir.rb
|
52
|
+
lib/chake/version.rb
|
53
|
+
lib/chake/wipe.rb
|
54
|
+
man/.gitignore
|
55
|
+
man/Rakefile
|
56
|
+
man/readme2man.sed
|
57
|
+
spec/chake/backend/local_spec.rb
|
58
|
+
spec/chake/backend/ssh_spec.rb
|
59
|
+
spec/chake/backend_spec.rb
|
60
|
+
spec/chake/config_manager/chef_spec.rb
|
61
|
+
spec/chake/config_manager/itamae_spec.rb
|
62
|
+
spec/chake/config_manager/shell_spec.rb
|
63
|
+
spec/chake/config_manager_spec.rb
|
64
|
+
spec/chake/node_spec.rb
|
65
|
+
spec/spec_helper.rb
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
NewCops: enable
|
5
|
+
Exclude:
|
6
|
+
- pkg/**/*
|
7
|
+
|
8
|
+
Layout/LineLength:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/BlockLength:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/PerceivedComplexity:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/FormatString:
|
27
|
+
EnforcedStyle: percent
|
28
|
+
|
29
|
+
Style/FrozenStringLiteralComment:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/GlobalVars:
|
33
|
+
Exclude:
|
34
|
+
- lib/chake.rb
|
35
|
+
|
36
|
+
Style/GuardClause:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/HashEachMethods:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/HashTransformKeys:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/HashTransformValues:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/IfUnlessModifier:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/SymbolArray:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Gemspec/RequiredRubyVersion:
|
55
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-03-25 17:43:43 -0300 using RuboCop version 0.52.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: EnforcedStyle.
|
12
|
+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
13
|
+
Layout/HeredocIndentation:
|
14
|
+
Exclude:
|
15
|
+
- 'lib/chake.rb'
|
16
|
+
|
17
|
+
# Offense count: 3
|
18
|
+
Lint/AmbiguousOperator:
|
19
|
+
Exclude:
|
20
|
+
- 'lib/chake.rb'
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
Lint/InterpolationCheck:
|
24
|
+
Exclude:
|
25
|
+
- 'lib/chake.rb'
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# Configuration parameters: Blacklist.
|
29
|
+
# Blacklist: END, (?-mix:EO[A-Z]{1})
|
30
|
+
Naming/HeredocDelimiterNaming:
|
31
|
+
Exclude:
|
32
|
+
- 'lib/chake.rb'
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
# Cop supports --auto-correct.
|
36
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
37
|
+
# SupportedStyles: nested, compact
|
38
|
+
Style/ClassAndModuleChildren:
|
39
|
+
Exclude:
|
40
|
+
- 'bin/chake'
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
# 0.81.1
|
2
|
+
|
3
|
+
* manpages: make sure all instances of \' are fixed
|
4
|
+
* rake nodes: format output by ourselves
|
5
|
+
|
6
|
+
# 0.81
|
7
|
+
|
8
|
+
* bootstrap/chef: exit if chef-solo is available
|
9
|
+
* Always bootstrap nodes
|
10
|
+
* Decrypt files in place when upload is not needed
|
11
|
+
* itamae: handle silent mode
|
12
|
+
* manpages: drop accute accent erroneously added by ronn
|
13
|
+
|
14
|
+
# 0.80
|
15
|
+
|
16
|
+
This release adds support for multiple configuration managers. Chef is now only
|
17
|
+
one of the options. There is also now support for configuration management with
|
18
|
+
itamae, and lightweight configuration management tool inspired by Chef, and via
|
19
|
+
shell commands. This should be mostly transparent to current Chef users, but
|
20
|
+
new repositories initiatied by chake will use itamae by default.
|
21
|
+
|
22
|
+
Other notable changes:
|
23
|
+
|
24
|
+
* rake nodes: list configuration manager and format as table
|
25
|
+
* Chake::Connection: fix handling of stderr
|
26
|
+
* Rebootstrap nodes when changing config managers
|
27
|
+
* bootstrap, upload: skip when config manager does not need them
|
28
|
+
|
29
|
+
# 0.21.2
|
30
|
+
|
31
|
+
* Chake::Backend#run: don't strip leading whitespace
|
32
|
+
|
33
|
+
# 0.21.1
|
34
|
+
|
35
|
+
* Fix converge when the connection is not already made as root. This bug was
|
36
|
+
introduced by the change in the previous release.
|
37
|
+
|
1
38
|
# 0.21
|
2
39
|
|
3
40
|
* converge, apply: allow removing data from the node JSON attributes
|
data/README.chef.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
chake-chef(7) -- configure chake nodes with chef-solo
|
2
|
+
=====================================================
|
3
|
+
|
4
|
+
## Description
|
5
|
+
|
6
|
+
This configuration manager will allow you to manage nodes by running
|
7
|
+
**chef-solo(1)** on each remote node.
|
8
|
+
|
9
|
+
When `chake init` runs, the following chef-specific files will be created:
|
10
|
+
|
11
|
+
A brief explanation of the created files that are specific to **chef**:
|
12
|
+
|
13
|
+
* `config.rb`: contains the chef-solo configuration. You can modify it, but
|
14
|
+
usually you won't need to.
|
15
|
+
* `config/roles`: directory is where you can put your role definitions.
|
16
|
+
* `cookbooks`: directory where you will store your cookbooks. A sample cookbook
|
17
|
+
called "basics" is created, but feel free to remove it and add actual
|
18
|
+
cookbooks.
|
19
|
+
|
20
|
+
## Configuration
|
21
|
+
|
22
|
+
Nodes can be configured to be managed with chef by having a `run_list` key in
|
23
|
+
their configuration:
|
24
|
+
|
25
|
+
```yaml
|
26
|
+
host1.mycompany.com:
|
27
|
+
run_list:
|
28
|
+
- role[server]
|
29
|
+
- recipe[service1]
|
30
|
+
service1:
|
31
|
+
option1: "here we go"
|
32
|
+
```
|
33
|
+
|
34
|
+
Any extra configuration under `host1.mycompany.com` will be saved to a JSON file
|
35
|
+
and given to the chef-solo --node-json option in the command line. For example,
|
36
|
+
the above configuration will produce a JSON file that looks like this:
|
37
|
+
|
38
|
+
```json
|
39
|
+
{
|
40
|
+
"run_list": [
|
41
|
+
"role[server]",
|
42
|
+
"recipe[service1]"
|
43
|
+
]
|
44
|
+
,
|
45
|
+
"service1": {
|
46
|
+
"option1": "here we go"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
Inside Chef recipes, you can access those values by using the `node` object.
|
52
|
+
For example:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
template "/etc/service1.conf.d/option1.conf" do
|
56
|
+
variables option1: node["option1"]
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
## Bootstrapping
|
61
|
+
|
62
|
+
The bootstrap process for _chef_ involves getting chef-solo installed. The
|
63
|
+
node hostname will also be set based on the hostname informed in the
|
64
|
+
configuration file.
|
65
|
+
|
66
|
+
## See also
|
67
|
+
|
68
|
+
* **chake(1)**
|
69
|
+
* <https://docs.chef.io/>
|
70
|
+
* <https://docs.chef.io/chef_solo.html>
|
data/README.itamae.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
chake-itamae(7) -- configure chake nodes with itamae
|
2
|
+
====================================================
|
3
|
+
|
4
|
+
## Description
|
5
|
+
|
6
|
+
This configuration manager will run **itamae(1)** against your nodes.
|
7
|
+
|
8
|
+
## Configuration
|
9
|
+
|
10
|
+
The _itamae_ configuration manager requires one key called `itamae`, and the
|
11
|
+
value must be a list of strings representing the list of recipes to apply to
|
12
|
+
the node when converging.
|
13
|
+
|
14
|
+
```yaml
|
15
|
+
host1.mycompany.com:
|
16
|
+
itamae:
|
17
|
+
- cookbooks/basic/default.rb
|
18
|
+
- roles/server.rb
|
19
|
+
service1:
|
20
|
+
option1: "here we go"
|
21
|
+
```
|
22
|
+
|
23
|
+
Any extra configuration under `host1.mycompany.com` will be saved to a JSON file
|
24
|
+
and given to the itamae --node-json option in the command line. For example,
|
25
|
+
the above configuration will produce a JSON file that looks like this:
|
26
|
+
|
27
|
+
```json
|
28
|
+
{
|
29
|
+
"itamae": [
|
30
|
+
"cookbooks/basic.rb",
|
31
|
+
"roles/server.rb"
|
32
|
+
]
|
33
|
+
,
|
34
|
+
"service1": {
|
35
|
+
"option1": "here we go"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
```
|
39
|
+
|
40
|
+
Inside itamae recipes, you can access those values by using the `node` object.
|
41
|
+
For example:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
template "/etc/service1.conf.d/option1.conf" do
|
45
|
+
variables option1: node["option1"]
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
## Bootstrapping
|
50
|
+
|
51
|
+
Very little bootstrapping is required for this configuration manager, as itamae
|
52
|
+
requires no setup on the node site since the Ruby code in the recipes is
|
53
|
+
interpreted locally and not on the nodes. During bootstrapping, only the node
|
54
|
+
hostname will be set according to your chake configuration.
|
55
|
+
|
56
|
+
## See also
|
57
|
+
|
58
|
+
* **chake(1)**
|
data/README.md
CHANGED
@@ -1,42 +1,58 @@
|
|
1
|
-
|
1
|
+
chake(1) -- serverless configuration management tool
|
2
|
+
========================================
|
2
3
|
|
3
|
-
##
|
4
|
+
## SYNOPSIS
|
4
5
|
|
5
|
-
chake
|
6
|
+
`chake` init
|
6
7
|
|
7
|
-
|
8
|
+
`chake` [rake arguments]
|
8
9
|
|
9
|
-
|
10
|
-
a chef server. Configuration is managed in a local directory, which should
|
11
|
-
probably be under version control with **git(1)** or anything else.
|
12
|
-
Configuration is usually deployed via rsync over SSH, and applied by invoking
|
13
|
-
**chef-solo(1)** over SSH on each host.
|
10
|
+
## Description
|
14
11
|
|
15
|
-
|
12
|
+
chake is a tool that helps you manage multiple hosts without the need for a
|
13
|
+
central server. Configuration is managed in a local directory, which should
|
14
|
+
(but doesn't need to) be under version control with **git(1)** or any other
|
15
|
+
version control system.
|
16
16
|
|
17
|
-
|
17
|
+
Configuration is deployed to managed hosts remotely, either by invoking a
|
18
|
+
configuration management tool that will connect to them, or by first uploading
|
19
|
+
the necessary configuration and them remotely running a tool on the hosts.
|
18
20
|
|
19
|
-
##
|
21
|
+
## Supported configuration managers.
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
chake supports the following configuration management tools:
|
24
|
+
|
25
|
+
* **itamae**: configuration is applied by running the itamae command line tool
|
26
|
+
on the management host; no configuration needs to be uploaded to the managed
|
27
|
+
hosts. See chake-itamae(7) for details.
|
28
|
+
* **shell**: the local repository is copied to the host, and the shell commands
|
29
|
+
specified in the node configuration is executed from the directory where that
|
30
|
+
copy is. See chake-shell(7) for details.
|
31
|
+
* **chef**: the local repository is copied to the host, and **chef-solo** is
|
32
|
+
executed remotely on the managed host. See chake-chef(7) for details.
|
33
|
+
|
34
|
+
Beyond applying configuration management recipes on the hosts, chake also
|
35
|
+
provides useful tools to manage multiple hosts, such as listing nodes, running
|
36
|
+
commands against all of them simultaneously, logging in to interactive
|
37
|
+
shells, and others.
|
38
|
+
|
39
|
+
## creating the repository
|
40
|
+
|
41
|
+
$ chake init[:configmanager]
|
31
42
|
|
32
|
-
|
43
|
+
This will create an initial directory structure. Some of the files are specific
|
44
|
+
to your your chosen **configmanager**, which can be one of [SUPPORTED
|
45
|
+
CONFIGURATION MANAGERS]. The following files, though, will be common to any
|
46
|
+
usage of chake:
|
33
47
|
|
34
|
-
* `nodes.yaml`: where you will list the hosts you will be managing, and what
|
35
|
-
|
36
|
-
* `
|
37
|
-
|
38
|
-
* `
|
39
|
-
|
48
|
+
* `nodes.yaml`: where you will list the hosts you will be managing, and what
|
49
|
+
recipes to apply to each of them.
|
50
|
+
* `nodes.d`: a directory with multiple files in the same format as nodes.yaml.
|
51
|
+
All files matching `*.yaml` in it will be added to the list of nodes.
|
52
|
+
* `Rakefile`: Contains just the `require 'chake'` line. You can augment it with
|
53
|
+
other tasks specific to your intrastructure.
|
54
|
+
|
55
|
+
If you omit _configmanager_, `itamae` will be used by default.
|
40
56
|
|
41
57
|
After the repository is created, you can call either `chake` or `rake`, as they
|
42
58
|
are completely equivalent.
|
@@ -48,10 +64,12 @@ following:
|
|
48
64
|
|
49
65
|
```yaml
|
50
66
|
host1.mycompany.com:
|
51
|
-
|
52
|
-
-
|
67
|
+
itamae:
|
68
|
+
- roles/basic.rb
|
53
69
|
```
|
54
70
|
|
71
|
+
The exact contents depends on the chosen configuration management tool.
|
72
|
+
|
55
73
|
You can list your hosts with `rake nodes`:
|
56
74
|
|
57
75
|
```
|
@@ -63,11 +81,11 @@ To add more nodes, just append to `nodes.yaml`:
|
|
63
81
|
|
64
82
|
```yaml
|
65
83
|
host1.mycompany.com:
|
66
|
-
|
67
|
-
-
|
84
|
+
itamae:
|
85
|
+
- roles/basic.rb
|
68
86
|
host2.mycompany.com:
|
69
|
-
|
70
|
-
-
|
87
|
+
itamae:
|
88
|
+
- roles/basic.rb
|
71
89
|
```
|
72
90
|
|
73
91
|
And chake now knows about your new node:
|
@@ -100,55 +118,53 @@ password prompts, you can:
|
|
100
118
|
|
101
119
|
## Checking connectivity and initial host setup
|
102
120
|
|
103
|
-
To check whether hosts are
|
121
|
+
To check whether hosts are correctly configured, you can use the `check` task:
|
104
122
|
|
105
|
-
```
|
123
|
+
```
|
106
124
|
$ rake check
|
107
125
|
```
|
108
126
|
|
109
127
|
That will run the the `sudo true` command on each host. If that pass without
|
110
|
-
you having to passwords,
|
128
|
+
you having to type any passwords, it means that:
|
111
129
|
|
112
130
|
* you have SSH access to each host; and
|
113
131
|
* the user you are connecting as has password-less sudo correctly setup.
|
114
132
|
|
115
|
-
|
116
|
-
$ rake check
|
117
|
-
```
|
118
|
-
|
119
|
-
## Applying cookbooks
|
133
|
+
## Applying configuration
|
120
134
|
|
121
135
|
Note that by default all tasks that apply to all hosts will run in parallel,
|
122
136
|
using rake's support for multitasks. If for some reason you need to prevent
|
123
137
|
that, you can pass `-j1` (or --jobs=1`) in the rake invocation. Note that by
|
124
138
|
default rake will only run N+4 tasks in parallel, where N is the number of
|
125
139
|
cores on the machine you are running it. If you have more than N+4 hosts and
|
126
|
-
want all of them to be handled in parallel, you might want
|
140
|
+
want all of them to be handled in parallel, you might want to pass `-j` (or
|
127
141
|
`--jobs`), without any number, as the last argument; with that rake will have
|
128
142
|
no limit on the number of tasks to perform in parallel.
|
129
143
|
|
130
|
-
|
131
144
|
To apply the configuration to all nodes, run
|
132
145
|
|
133
|
-
```
|
146
|
+
```
|
134
147
|
$ rake converge
|
135
148
|
```
|
136
149
|
|
137
150
|
To apply the configuration to a single node, run
|
138
151
|
|
139
|
-
```
|
152
|
+
```
|
140
153
|
$ rake converge:$NODE
|
141
154
|
```
|
142
155
|
|
143
156
|
To apply a single recipe on all nodes, run
|
144
157
|
|
145
|
-
```
|
158
|
+
```
|
146
159
|
$ rake apply[myrecipe]
|
147
160
|
```
|
148
161
|
|
162
|
+
What `recipe` is depends on the configuration manager.
|
163
|
+
|
164
|
+
|
149
165
|
To apply a single recipe on a specific node, run
|
150
166
|
|
151
|
-
```
|
167
|
+
```
|
152
168
|
$ rake apply:$NODE[myrecipe]
|
153
169
|
```
|
154
170
|
|
@@ -156,12 +172,24 @@ If you don't inform a recipe in the command line, you will be prompted for one.
|
|
156
172
|
|
157
173
|
To run a shell command on all nodes, run
|
158
174
|
|
175
|
+
```
|
176
|
+
$ rake run
|
177
|
+
```
|
178
|
+
The above will prompt you for a command, then execute it on all nodes.
|
179
|
+
|
180
|
+
To pass the command to run in the command line, use the following syntax:
|
181
|
+
|
159
182
|
```
|
160
183
|
$ rake run[command]
|
161
184
|
```
|
162
185
|
|
163
186
|
If the `command` you want to run contains spaces, or other characters that are
|
164
|
-
special do the shell, you have to quote them
|
187
|
+
special do the shell, you have to quote them, for example:
|
188
|
+
|
189
|
+
```
|
190
|
+
$ rake run["cat /etc/hostname"]
|
191
|
+
```
|
192
|
+
|
165
193
|
|
166
194
|
To run a shell command on a specific node, run
|
167
195
|
|
@@ -169,28 +197,29 @@ To run a shell command on a specific node, run
|
|
169
197
|
$ rake run:$NODE[command]
|
170
198
|
```
|
171
199
|
|
172
|
-
|
173
|
-
|
200
|
+
As before, if you run just `rake run:$NODE`, you will be prompted for the
|
201
|
+
command.
|
174
202
|
|
175
|
-
To
|
203
|
+
To list all existing tasks, run:
|
176
204
|
|
177
|
-
```
|
205
|
+
```
|
178
206
|
$ rake -T
|
179
207
|
```
|
180
208
|
|
181
|
-
## Writing
|
209
|
+
## Writing configuration management code
|
182
210
|
|
183
|
-
|
184
|
-
|
185
|
-
|
211
|
+
As chake supports different configuration management tools, the specifics of
|
212
|
+
configuration management code depends on the the tool you choose. See the
|
213
|
+
corresponding documentation.
|
186
214
|
|
187
215
|
## The node bootstrapping process
|
188
216
|
|
189
|
-
|
190
|
-
|
217
|
+
Some of the configuration management tools require some software to be
|
218
|
+
installed on the managed hosts. When that's the case, chake acts on a node for
|
219
|
+
the first time, it has to bootstrap it. The bootstrapping process includes
|
220
|
+
doing the following:
|
191
221
|
|
192
|
-
- installing
|
193
|
-
- disabling the chef client daemon
|
222
|
+
- installing and configuring the needed software
|
194
223
|
- setting up the hostname
|
195
224
|
|
196
225
|
## Node URLs
|
@@ -201,10 +230,10 @@ is the simplest form of specifying your nodes. Here are all the components of
|
|
201
230
|
the node URLs:
|
202
231
|
|
203
232
|
```
|
204
|
-
[
|
233
|
+
[connection://][username@]hostname[:port][/path]
|
205
234
|
```
|
206
235
|
|
207
|
-
* `
|
236
|
+
* `connection`: what to use to connect to the host. `ssh` or `local` (default: `ssh`)
|
208
237
|
* `username`: user name to connect with (default: the username on your local workstation)
|
209
238
|
* `hostname`: the hostname to connect to (default: _none_)
|
210
239
|
* `port`: port number to connect to (default: 22)
|
@@ -228,7 +257,7 @@ converging. To do this, you just need to enhance the corresponding tasks:
|
|
228
257
|
|
229
258
|
Example:
|
230
259
|
|
231
|
-
```
|
260
|
+
```ruby
|
232
261
|
task :bootstrap_common do
|
233
262
|
sh './scripts/pre-bootstrap-checks'
|
234
263
|
end
|
@@ -237,10 +266,19 @@ end
|
|
237
266
|
### Encrypted files
|
238
267
|
|
239
268
|
Any files ending matching `*.gpg` and `*.asc` will be decrypted with GnuPG
|
240
|
-
before being sent to the node
|
269
|
+
before being sent to the node (for the configuration management tools that
|
270
|
+
required files to be sent). You can use them to store passwords and other
|
241
271
|
sensitive information (SSL keys, etc) in the repository together with the rest
|
242
272
|
of the configuration.
|
243
273
|
|
274
|
+
For configuration managers that don't require uploading files to the managed
|
275
|
+
node, this decryption will happen right before converging or applying single
|
276
|
+
recipes, and the decrypted files will be wiped right after that.
|
277
|
+
|
278
|
+
If you use this feature, make sure that you have the `wipe` program installed.
|
279
|
+
This way chake will be able to delete the decrypted files in a slightly more
|
280
|
+
secure way, after being done with them.
|
281
|
+
|
244
282
|
### repository-local SSH configuration
|
245
283
|
|
246
284
|
If you need special SSH configuration parameters, you can create a file called
|
@@ -260,7 +298,7 @@ Some times, you will also want or need to prefix your SSH invocations with some
|
|
260
298
|
prefix command in order to e.g. tunnel it through some central exit node. You
|
261
299
|
can do this by setting `$CHAKE_SSH_PREFIX` on your environment. Example:
|
262
300
|
|
263
|
-
```
|
301
|
+
```bash
|
264
302
|
CHAKE_SSH_PREFIX=tsocks rake converge
|
265
303
|
```
|
266
304
|
|
@@ -269,28 +307,29 @@ The above will make all SSH invocations to all hosts be called as `tsocks ssh
|
|
269
307
|
|
270
308
|
### Converging local host
|
271
309
|
|
272
|
-
If you want to manage your local workstation with chake, you can declare a
|
310
|
+
If you want to manage your local workstation with chake, you can declare a
|
311
|
+
local node using the "local" connection type, like this (in `nodes.yaml`):
|
273
312
|
|
274
313
|
```yaml
|
275
314
|
local://thunderbolt:
|
276
|
-
|
277
|
-
- role
|
315
|
+
itamae:
|
316
|
+
- role/workstation.rb
|
278
317
|
```
|
279
318
|
|
280
319
|
To apply the configuration to the local host, you can use the conventional
|
281
320
|
`rake converge:thunderbolt`, or the special target `rake local`.
|
282
321
|
|
283
322
|
When converging all nodes, `chake` will skip nodes that are declared with the
|
284
|
-
`local://`
|
323
|
+
`local://` connection and whose hostname does not match the hostname in the
|
285
324
|
declaration. For example:
|
286
325
|
|
287
326
|
```yaml
|
288
327
|
local://desktop:
|
289
|
-
|
290
|
-
- role
|
328
|
+
itamae:
|
329
|
+
- role/workstation.rb
|
291
330
|
local://laptop:
|
292
|
-
|
293
|
-
- role
|
331
|
+
itamae:
|
332
|
+
- role/workstation.rb
|
294
333
|
```
|
295
334
|
|
296
335
|
When you run `rake converge` on `desktop`, `laptop` will be skipped, and
|
@@ -330,13 +369,7 @@ end
|
|
330
369
|
|
331
370
|
## See also
|
332
371
|
|
333
|
-
* **rake(1)
|
334
|
-
*
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
1. Fork it ( http://github.com/terceiro/chake/fork )
|
339
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
340
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
341
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
342
|
-
5. Create new Pull Request
|
372
|
+
* **rake(1)**
|
373
|
+
* **chake-itamae(7)**, https://itamae.kitchen/
|
374
|
+
* **chake-shell(7)**
|
375
|
+
* **chake-chef(7)**, **chef-solo(1)**, https://docs.chef.io/
|