chake 0.3.1 → 0.3.2

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: e900187a5fdfbed5fb3712c249f00b23c66d05bc
4
- data.tar.gz: 5024eaab5d4de0e7f30fd1f1839a2e690cb11fa3
3
+ metadata.gz: 6ccedd33bee72b8c2b029a07bdb3519447db80d6
4
+ data.tar.gz: e742e82cb94db00ab390a154babda6d784fa0d05
5
5
  SHA512:
6
- metadata.gz: 5f2d124d8a2e00c90e15a27de6a8c3db136e130b8cc9258790d22ae70a8f0269c1d6b5bde4144d51590a1e2e99aff6fd99a748a1ef83f22d3fd9a065ba24bfe1
7
- data.tar.gz: 34f103cc2a3997dbc178589d29da4c6bac88056db49266483cac298be935a8985a58120dda521b7b7f20adf4ab52ef36e6d554dd5567166252d4a6296d3fed6f
6
+ metadata.gz: 210582e1e859931e33b3fb80af745699980414859e153f1f33be2040b01786f7bc853c96c0da61f8569bed3ddd66339498fb5223a8dd0499cffe70fb26e8a92b
7
+ data.tar.gz: 8e00de96b07d27cd1cdc444ce625daa02c2ea3cf5259487519cd991321d99e164158c8b886ab549ed0956b0149915dd8775d58c60be4cfbd2d1b45d0da1f558b
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  /examples/test/nodes.yaml
19
19
  /examples/test/.tmp
20
+ .*.html
@@ -1,3 +1,10 @@
1
+ # 0.3.2
2
+
3
+ * Now finally, hopefully, really fix RPM builds
4
+ * chake init: rename 'myhost' → 'basics'
5
+ * The official home is on gitlab
6
+ * Completed basic documentation
7
+
1
8
  # 0.3.1
2
9
 
3
10
  * Fix setting hostname when bootstrapping
data/README.md CHANGED
@@ -6,7 +6,7 @@ Simple host management with chef and rake. No chef server required.
6
6
 
7
7
  $ gem install chake
8
8
 
9
- ## Usage
9
+ ## Creating the repository
10
10
 
11
11
  Require chake on your `Rakefile`:
12
12
 
@@ -16,43 +16,179 @@ require 'chake'
16
16
 
17
17
  Initializing the repository:
18
18
 
19
- $ rake init
19
+ ```
20
+ $ chake init
21
+ [create] nodes.yaml
22
+ [create] config.rb
23
+ [ mkdir] config/roles
24
+ [ mkdir] cookbooks/basics/recipes/
25
+ [create] cookbooks/basics/recipes/default.rb
26
+ [create] Rakefile
27
+ ```
20
28
 
29
+ A brief explanation of the created files:
21
30
 
22
- Important files that are generated:
31
+ | File | Description |
32
+ |-----+-------|
33
+ | `nodes.yaml` | where you will list the hosts you will be managing, and what recipes to apply to each of them. |
34
+ | `config.rb` | contains the chef-solo configuration. You can modify it, but usually you won't need to. |
35
+ | `config/roles` | directory is where you can put your role definitions. |
36
+ | `cookbooks` | directory where you will store your cookbooks. A sample cookbook called "basics" is created, but feel free to remove it and add actual cookbooks. |
37
+ | `Rakefile` | Contains just the `require 'chake'` line. You can augment it with other tasks specific to your intrastructure. |
23
38
 
24
- ```
25
- config.rb
26
- nodes.yaml
27
- config/
28
- config/roles/
29
- cookbooks/
30
- cookbooks/myhost/
31
- cookbooks/myhost/recipes/
32
- cookbooks/myhost/recipes/default.rb
39
+ After the repository is created, you can call either `chake` or `rake`, as they
40
+ are completely equivalent.
41
+
42
+ ## Managing nodes and recipes
33
43
 
44
+ Just after you created your repository, the contents of `nodes.yaml` is the
45
+ following:
46
+
47
+ ```yaml
48
+ host1.mycompany.com:
49
+ run_list:
50
+ - recipe[basics]
34
51
  ```
35
52
 
36
- * `nodes.yaml`, where you will list the hosts you will be managing.
37
- * a `cookbooks` directory where you will store your cookbooks. A sample
38
- cookbook called "myhost" is created, but feel free to remove it and add
39
- actual cookbooks.
53
+ You can list your hosts with `rake nodes`:
40
54
 
55
+ ```
56
+ $ rake nodes
57
+ host1.mycompany.com ssh
58
+ ```
41
59
 
42
- Sample `nodes.yaml`:
60
+ To add more nodes, just append to `nodes.yaml`:
43
61
 
44
62
  ```yaml
45
63
  host1.mycompany.com:
46
- run_list:
47
- - recipe[common]
48
- - recipe[webserver]
64
+ run_list:
65
+ - recipe[basics]
49
66
  host2.mycompany.com:
50
- run_list:
51
- - recipe[common]
52
- - recipe[mailserver]
67
+ run_list:
68
+ - recipes[basics]
69
+ ```
70
+
71
+ And chake now knows about your new node:
72
+
73
+ ```
74
+ $ rake nodes
75
+ host1.mycompany.com ssh
76
+ host2.mycompany.com ssh
77
+ ```
78
+
79
+ ## Preparings nodes to be managed
80
+
81
+ Nodes has very few requirements to be managed with `chake`:
82
+
83
+ - The node must be accessible via SSH.
84
+ - The node must have `sudo` installed.
85
+ - The user you connect to the node must either be `root`, or be allowed to run
86
+ `sudo`.
87
+
88
+ **A note on password prompts:** every time chake calls ssh on a node, you may
89
+ be required to type in your password; every time chake calls sudo on the node,
90
+ you may be require to type in your password. For managaing one or two nodes
91
+ this is probably fine, but for larger numbers it is not practical. To avoid
92
+ password prompts, you can:
93
+
94
+ - configure SSH key authentication.
95
+ - this is more secure than using passwords, anyway.
96
+ - bonus points: disable password authentication completely, and only allow
97
+ key-based authentication
98
+ - configure passwordless `sudo` access for your user on the server
99
+
100
+ ## Applying cookbooks
101
+
102
+ To apply the configuration to all nodes, run
103
+
104
+ ```bash
105
+ $ rake converge
106
+ ```
107
+
108
+ To apply the configuration to a single node, run
109
+
110
+ ```bash
111
+ $ rake converge:$NODE
112
+ ```
113
+
114
+ ## Writing cookbooks
115
+
116
+ Since chake is actually a wrapper for Chef Solo, you should read the [chef
117
+ documentation](https://docs.chef.io/). In special, look at the [Chef Solo
118
+ Documentation](https://docs.chef.io/chef_solo.html).
119
+
120
+ ## The node bootstrapping process
121
+
122
+ When chake acts on a node for the first time, it has to bootstrap it. The
123
+ bootstrapping process includes doing the following:
124
+
125
+ - installing chef and rsync
126
+ - disabling the chef client daemon
127
+ - setting up the hostname
128
+
129
+ ## Node URLs
130
+
131
+ The keys in the hash that is represented in `nodes.yaml` is a node URL. All
132
+ components of the URL but the hostname are optional, so just listing hostnames
133
+ is the simplest form of specifying your nodes. Here are all the components of
134
+ the node URLs:
135
+
136
+ ```
137
+ [backend://][username@]hostname[:port][/path]
138
+ ```
139
+
140
+ |Parameter|Meaning|Default value|
141
+ |---------|-------|-------------|
142
+ | backend | backend to use to connect to the host. `ssh` or `local` | `ssh` |
143
+ | username | user name to connect with | The username on your local workstation |
144
+ | hostname | the hostname to connect to | _none_ |
145
+ | port | port number to connect to | 22 |
146
+ | /path | where to store the cookbooks at the node | `/var/tmp/chef.$USERNAME` |
147
+
148
+
149
+ ## Extra features
150
+
151
+ ### Encrypted files
152
+
153
+ Any files ending matching `*.gpg` and `*.asc` will be decrypted with GnuPG
154
+ before being sent to the node. You can use them to store passwords and other
155
+ sensitive information (SSL keys, etc) in the repository together with the rest
156
+ of the configuration.
157
+
158
+ ### repository-local SSH configuration
159
+
160
+ If you need special SSH configuration parameters, you can create a file called
161
+ `.ssh_config` in at the root of your repository, and chake will use it when
162
+ calling `ssh`.
163
+
164
+ ### Converging local host
165
+
166
+ If you want to manage your local workstation with chake, you can declare a local node like this in `nodes.yaml`:
167
+
168
+ ```yaml
169
+ local://thunderbolt:
170
+ run_list:
171
+ - role[workstation]
172
+ ```
173
+
174
+ To apply the configuration to the local host, you can use the conventional
175
+ `rake converse:thunderbolt`, or the special target `rake local`.
176
+
177
+ When converging all nodes, `chake` will skip nodes that are declared with the
178
+ `local://` backend and whose hostname does not match the hostname in the
179
+ declaration. For example:
180
+
181
+ ```yaml
182
+ local://desktop:
183
+ run_list:
184
+ - role[workstation]
185
+ local://laptop:
186
+ run_list:
187
+ - role[workstation]
53
188
  ```
54
189
 
55
- Check the output of `rake -T` to see what else you can do.
190
+ When you run `rake converge` on `desktop`, `laptop` will be skipped, and
191
+ vice-versa.
56
192
 
57
193
  ## Contributing
58
194
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["terceiro@softwarelivre.org"]
11
11
  spec.summary = %q{Simple host management with chef and rake. No chef server required.}
12
12
  spec.description = %q{chake provides a set of rake tasks that you can use to manage any number of hosts via SSH. It doesn't require a chef server; all you need is a workstation from where you can SSH into all your hosts.}
13
- spec.homepage = "https://github.com/terceiro/chake"
13
+ spec.homepage = "https://gitlab.com/terceiro/chake"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -31,7 +31,7 @@ Requires: ruby, rubygem-rake
31
31
  %install
32
32
  %{__rm} -rf %{buildroot}
33
33
  mkdir -p %{gembuilddir}
34
- sed -i -e 's#spec.files\s*=.*#spec.files = Dir.glob('**/*')#' %{name}.gemspec
34
+ sed -i -e 's#spec.files\s*=.*#spec.files = Dir.glob("**/*")#' %{name}.gemspec
35
35
  rake build
36
36
  gem install --local --install-dir %{gembuilddir} --force pkg/*.gem
37
37
  mkdir -p %{buildroot}/%{_bindir}
@@ -19,9 +19,9 @@ task :init do
19
19
  else
20
20
  File.open('nodes.yaml', 'w') do |f|
21
21
  sample_nodes = <<EOF
22
- host1.my.tld:
22
+ host1.mycompany.com:
23
23
  run_list:
24
- - recipe[myhost]
24
+ - recipe[basics]
25
25
  EOF
26
26
  f.write(sample_nodes)
27
27
  puts "[create] nodes.yaml"
@@ -43,11 +43,11 @@ EOF
43
43
  FileUtils.mkdir_p 'config/roles'
44
44
  puts '[ mkdir] config/roles'
45
45
  end
46
- if !File.exist?('cookbooks/myhost/recipes')
47
- FileUtils.mkdir_p 'cookbooks/myhost/recipes/'
48
- puts '[ mkdir] cookbooks/myhost/recipes/'
46
+ if !File.exist?('cookbooks/basics/recipes')
47
+ FileUtils.mkdir_p 'cookbooks/basics/recipes/'
48
+ puts '[ mkdir] cookbooks/basics/recipes/'
49
49
  end
50
- recipe = 'cookbooks/myhost/recipes/default.rb'
50
+ recipe = 'cookbooks/basics/recipes/default.rb'
51
51
  if File.exists?(recipe)
52
52
  puts "[exists] #{recipe}"
53
53
  else
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
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.3.1
4
+ version: 0.3.2
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-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,7 @@ files:
89
89
  - spec/chake/backend_spec.rb
90
90
  - spec/chake/node_spec.rb
91
91
  - spec/spec_helper.rb
92
- homepage: https://github.com/terceiro/chake
92
+ homepage: https://gitlab.com/terceiro/chake
93
93
  licenses:
94
94
  - MIT
95
95
  metadata: {}