hazetug 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +85 -49
- data/lib/hazetug/tug/knife.rb +1 -1
- data/lib/hazetug/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: 5cd75f4fabfcaaeae0bd462bdbb4548bd75c5cc0
|
4
|
+
data.tar.gz: 4179c6ff8d922ca64274ff15a43d76ac595c7ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd3762608a28281c7403f9916097378b154ca75514b71ece5d228af8b776d3bdf8346705d06adfdd739cc2f03d96a0f1f436d3f5fcd260daadf394c4447d630
|
7
|
+
data.tar.gz: b47dda53a33e5260082d73de1133beb462c1ec540af8651d5d81e7afc1674195c5fc8e75eccc0a23caf6bfcbe850f809c36a8fcb13e187b167e767a35de7e20e
|
data/README.md
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
# Hazetug
|
2
2
|
|
3
|
-
Cloud provisioner and
|
4
|
-
Hazetug uses [fog cloud library](http://fog.io) to be able to easily append other cloud computes and *tugs* (bootstraps) hosts using:
|
3
|
+
Cloud provisioner and bootstraper which simplifies node creation and configuration deployment. Hazetug uses simple YAML task file which describes the configuration to setup.
|
5
4
|
|
6
|
-
*
|
7
|
-
* Knife bootstrap for chef-solo.
|
5
|
+
Provisioning is handled by *haze* core which is based on [fog cloud library](http://fog.io). A plenty of different cloud computes available in fog (*AWS*, *Rackspace*, *BareMetalCloud* and many more) helps to extend hazetug with the new *"hazes"* quite simple.
|
8
6
|
|
9
|
-
|
7
|
+
Bootstrapping is done by *"tugs"*, hazetug supports only a few tugs just for Chef now.
|
8
|
+
|
9
|
+
## Supported cloud computes
|
10
|
+
|
11
|
+
- Linode
|
12
|
+
- DigitalOcean
|
13
|
+
|
14
|
+
## Supported bootstrap methods
|
15
|
+
|
16
|
+
- **knife** - chef knife bootstrap method.
|
17
|
+
- **solo** - same as *knife* bootstrap, but it also uses [berkshelf](http://berkshelf.com) to package and upload cookbooks to a provisioned node, thus makes it possible usage of *chef-solo*.
|
18
|
+
|
19
|
+
## Task file options
|
10
20
|
|
11
21
|
### Cloud Computes specific options
|
12
22
|
|
@@ -21,7 +31,7 @@ Hazetug uses [fog cloud library](http://fog.io) to be able to easily append othe
|
|
21
31
|
</tr>
|
22
32
|
<tr>
|
23
33
|
<td><b><i>location</i></b></td>
|
24
|
-
<td>Location in
|
34
|
+
<td>Location in a cloud compute, namely data center.</td>
|
25
35
|
</tr>
|
26
36
|
<tr>
|
27
37
|
<td><b><i>flavor</i></b></td>
|
@@ -43,7 +53,7 @@ Hazetug uses [fog cloud library](http://fog.io) to be able to easily append othe
|
|
43
53
|
</tr>
|
44
54
|
<tr>
|
45
55
|
<td><b><i>ssh_user</i></b></td>
|
46
|
-
<td>User used
|
56
|
+
<td>User used during provisioning and bootstrapping for connecting via ssh.</td>
|
47
57
|
<td><i>root</i><td>
|
48
58
|
</tr>
|
49
59
|
<tr>
|
@@ -96,6 +106,11 @@ Hazetug uses [fog cloud library](http://fog.io) to be able to easily append othe
|
|
96
106
|
<td><b>Description</b></td>
|
97
107
|
<td><b>Default value</b></td>
|
98
108
|
</tr>
|
109
|
+
<tr>
|
110
|
+
<td><b><i>chef_environment</i></b></td>
|
111
|
+
<td>Chef Environment used during bootstrap</td>
|
112
|
+
<td></td>
|
113
|
+
</tr>
|
99
114
|
<tr>
|
100
115
|
<td><b><i>attributes</i></b></td>
|
101
116
|
<td>Hash of attributes prepared for chef-solo run. (It's merged with the run_list).</td>
|
@@ -104,16 +119,29 @@ Hazetug uses [fog cloud library](http://fog.io) to be able to easily append othe
|
|
104
119
|
<tr>
|
105
120
|
<td><b><i>berksfile</i></b></td>
|
106
121
|
<td>Path to Berksfile.</td>
|
107
|
-
<td></td>
|
122
|
+
<td><i>./Berksfile</i></td>
|
108
123
|
</tr>
|
109
124
|
</table>
|
110
125
|
|
126
|
+
## Configuration
|
127
|
+
|
128
|
+
### Variables priority
|
129
|
+
|
130
|
+
Hazetug uses 3-level priority for flexible variable choosing. Priority in the ascending order is the following: variable from the global section -> variable set via command option -> variable in the bootstrap list entity.
|
131
|
+
All variables are merged using this 3-level priority.
|
132
|
+
|
133
|
+
### Tug bootstrap templates
|
134
|
+
|
135
|
+
*Knife* and *solo* tugs use ruby ERB bootstrap template file which is basically a shell script performing initial bootstrap phase. Namely performing OS update and system package installation, bootstrapping ruby and chef.
|
136
|
+
|
111
137
|
|
112
138
|
## Installation
|
113
139
|
|
114
140
|
Add this line to your application's Gemfile:
|
115
141
|
|
116
142
|
gem 'hazetug'
|
143
|
+
# use master until version grater than 1.23.0 is released
|
144
|
+
gem 'fog', git: 'https://github.com/fog/fog.git'
|
117
145
|
|
118
146
|
And then execute:
|
119
147
|
|
@@ -125,7 +153,7 @@ Or install it yourself as:
|
|
125
153
|
|
126
154
|
## Usage
|
127
155
|
|
128
|
-
###
|
156
|
+
### 1. Create ~/.hazetug configuration file
|
129
157
|
|
130
158
|
Create *~/.hazetug* configuration file, with the content like:
|
131
159
|
|
@@ -140,9 +168,12 @@ default:
|
|
140
168
|
- ~/.ssh/digitalocean.pem (Change with your path)
|
141
169
|
```
|
142
170
|
|
143
|
-
###
|
171
|
+
### 2. Define task
|
144
172
|
|
145
|
-
Hazetug
|
173
|
+
Hazetug YAML task file consists of two sections **global** and **bootstrap**. Global section sets default variables used by hazetug and bootstrap section is basically a list of nodes to be provisioned and to be bootstrapped.
|
174
|
+
Each bootstrap entity includes *haze specification* (name, location, flavor and image) as well as it defines node specific variables.
|
175
|
+
|
176
|
+
Let's have a look at a sample task file:
|
146
177
|
|
147
178
|
```
|
148
179
|
chef_server_url: 'https://mychefserver.uri'
|
@@ -159,78 +190,83 @@ bootstrap:
|
|
159
190
|
run_list: ["role[api]"]
|
160
191
|
```
|
161
192
|
|
162
|
-
|
193
|
+
This simple configuration is supposed to bring 6 nodes in the Cloud and bootstrap the with *knife* tug.
|
163
194
|
|
164
|
-
|
195
|
+
Also it's worth mentioning the variables priority look into the [Variables Priority](README.md#variables-priority) section.
|
165
196
|
|
166
|
-
|
167
|
-
|
197
|
+
### 3. Create bootstrap template file
|
198
|
+
|
199
|
+
Use one of the bootstrap templates provided in the *examples* directory or create yours.
|
168
200
|
|
201
|
+
### 4. Run hazetug
|
169
202
|
|
170
|
-
|
203
|
+
`bundle exec hazetug digitalocean bootstrap knife -b bootstrap.erb task.yaml`
|
171
204
|
|
172
|
-
|
205
|
+
## Command line and invocation
|
173
206
|
|
174
|
-
|
207
|
+
### Tug with chef-client and chef-solo (knife bootstrap)
|
208
|
+
|
209
|
+
Let's first have a look at command line help, issue the following command: `hazetug help digitalocean bootstrap knife`, and this will show you:
|
175
210
|
|
176
211
|
```
|
177
212
|
NAME
|
178
|
-
|
213
|
+
bootstrap - Provisions and bootstraps server
|
179
214
|
|
180
215
|
SYNOPSIS
|
181
|
-
hazetug
|
216
|
+
hazetug [global options] digitalocean bootstrap [command options] knife <task.yaml>
|
217
|
+
hazetug [global options] digitalocean bootstrap [command options] solo <task.yaml>
|
182
218
|
|
183
219
|
COMMAND OPTIONS
|
184
220
|
-v, --variables=arg - Set variable or comma-seperated list of variables (var1_1=hello) (default: none)
|
185
221
|
-n, --number=arg - Set number of created nodes, value from yaml is honored (default: 1)
|
186
222
|
-c, --concurrency=arg - Set concurrency value, i.e. number of hosts bootstraped simultaneously (default: 1)
|
187
223
|
-b, --bootstrap=arg - Set path to knife bootstrap.erb file (default: bootstrap.erb)
|
224
|
+
|
225
|
+
COMMANDS
|
226
|
+
knife - Bootstraps server using Knife in client mode
|
227
|
+
solo - Bootstraps server using Knife in solo mode
|
188
228
|
```
|
189
229
|
|
190
|
-
|
230
|
+
Concurrency and number are used to control hazetug provision and bootstrap flow. When we create 20 identical nodes we might want to process say it 4 nodes simultaneously, so we will use `-n 20 -c 4` on the command line.
|
231
|
+
|
232
|
+
Variables are useful to define some parameter for hazetug, providing a variable on command line will redefine the corresponding variable in global section. So it's useful to specify something like: `-v chef_version=11.16.0.rc.0,ruby_version=2.1.2`.
|
233
|
+
|
234
|
+
#### Variables available in bootstrap template
|
191
235
|
|
192
|
-
|
236
|
+
Variables are merged and passed by tug into bootstrap template, use *hasetug[:variable]* to look up a value. For a example to get *chef_version* or *node location* it will be easy as this:
|
193
237
|
|
194
|
-
|
238
|
+
```
|
239
|
+
<%= hazetug[:chef_version] %>
|
240
|
+
<%= hazetug[:location] %>
|
241
|
+
```
|
195
242
|
|
196
|
-
|
197
|
-
<pre>
|
198
|
-
hazetug digitalocean bootstrap solo -b bootstrap.erb solo-task.yaml
|
199
|
-
</pre>
|
243
|
+
While all the variables you've specified on command line and inside YAML task file are being merged and are available there are other dynamic values which might be useful as well:
|
200
244
|
|
201
|
-
|
245
|
+
- compute_name
|
246
|
+
- public_ip_address
|
247
|
+
- private_ip_address
|
248
|
+
- ssh_password
|
202
249
|
|
203
|
-
When defining a task, there additional options **berksfile** and **attributes**
|
204
250
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
bootstrap
|
209
|
-
- name: solo-box
|
210
|
-
location: london
|
211
|
-
flavor: 1gb
|
212
|
-
image: ubuntu-14.04-x64
|
213
|
-
run_list: ["role[api]"]
|
214
|
-
attributes: {
|
215
|
-
"mycookbook": {
|
216
|
-
"settings": {}
|
217
|
-
}
|
218
|
-
}
|
219
|
-
```
|
251
|
+
#### knife and solo tugs difference
|
252
|
+
|
253
|
+
They both use knife bootstrap, but *knife* is supposed to run chef-client while *solo* to run chef-solo. Also they use a little bit different options look at the [Task file options](README.md#task-file-options) section.
|
254
|
+
For more information on the bootstrap process have a look into *examples* directory.
|
220
255
|
|
221
|
-
|
256
|
+
More details about *solo* tug should be also given here. An important difference that *solo* tug is assisted by berkshelf to create and upload cookbooks package that makes possible **chef-solo** invocation. In the *examples* there's the line starting chef-solo:
|
257
|
+
`chef-solo -j /etc/chef/first-boot.json -r <%= hazetug[:cookbooks_file] %>`
|
222
258
|
|
223
|
-
Another
|
259
|
+
Another note is about *run_list* and *attributes*, just mention that *run_list* is merged into *attributes* and available as `hazetug[:attributes_json]` inside the bootstrap template.
|
224
260
|
|
225
|
-
####
|
261
|
+
#### Invocation examples
|
226
262
|
|
227
263
|
* Provisioning and bootstrapping 5 nodes, each 3 of them will be processed simultaneously:
|
228
264
|
|
229
|
-
`hazetug digitalocean bootstrap knife -n 5 -c 3 -b api.erb api-task.yaml`
|
265
|
+
`bundle exec hazetug digitalocean bootstrap knife -n 5 -c 3 -b api.erb api-task.yaml`
|
230
266
|
|
231
267
|
* Redefining validation_key and chef_version:
|
232
268
|
|
233
|
-
`hazetug digitalocean bootstrap knife -v validation_key=/tmp/validation.pem,chef_version=11.12.4 api.erb api-task.yaml`
|
269
|
+
`bundle hazetug digitalocean bootstrap knife -v validation_key=/tmp/validation.pem,chef_version=11.12.4 api.erb api-task.yaml`
|
234
270
|
|
235
271
|
## Contributing
|
236
272
|
|
data/lib/hazetug/tug/knife.rb
CHANGED
data/lib/hazetug/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hazetug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Barishev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|