stork 0.1.0.pre → 0.2.0.pre
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/.gitignore +3 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +7 -8
- data/README.md +521 -4
- data/bin/stork +19 -5
- data/bin/storkctl +39 -9
- data/box/Vagrantfile +41 -0
- data/box/bootstrap.sh +317 -0
- data/box/integration.sh +33 -0
- data/lib/stork/builder.rb +78 -24
- data/lib/stork/client/plugins/host_actions.rb +12 -0
- data/lib/stork/client/plugins/host_list.rb +1 -1
- data/lib/stork/client/plugins/host_reload.rb +16 -0
- data/lib/stork/client/plugins/host_show.rb +1 -1
- data/lib/stork/client/plugins/host_sync.rb +16 -0
- data/lib/stork/collections.rb +1 -0
- data/lib/stork/configuration.rb +51 -92
- data/lib/stork/database.rb +96 -0
- data/lib/stork/deploy/command.rb +8 -0
- data/lib/stork/deploy/install_script.rb +3 -5
- data/lib/stork/deploy/kickstart_binding.rb +4 -6
- data/lib/stork/deploy/section.rb +11 -7
- data/lib/stork/deploy/snippet_binding.rb +15 -10
- data/lib/stork/plugin.rb +24 -5
- data/lib/stork/pxe.rb +2 -2
- data/lib/stork/resource/base.rb +0 -2
- data/lib/stork/resource/delegator.rb +0 -2
- data/lib/stork/resource/host.rb +23 -23
- data/lib/stork/resource/logical_volume.rb +1 -1
- data/lib/stork/server/application.rb +75 -13
- data/lib/stork/server/control.rb +82 -21
- data/lib/stork/version.rb +1 -1
- data/lib/stork.rb +4 -3
- data/specs/builder_spec.rb +5 -1
- data/specs/configuration_spec.rb +16 -133
- data/specs/database_spec.rb +33 -0
- data/specs/deploy_snippet_binding_spec.rb +15 -0
- data/specs/kickstart_spec.rb +1 -0
- data/specs/pxe_spec.rb +2 -2
- data/specs/resource_host_spec.rb +121 -261
- data/specs/scripts/kssetup.sh +2 -2
- data/specs/server_spec.rb +46 -24
- data/specs/spec_helper.rb +3 -2
- data/specs/stork/bundles/hosts/example.org.rb +2 -1
- data/specs/stork/bundles/public/file.txt +5 -0
- data/specs/stork/config.rb +1 -0
- data/stork.gemspec +3 -1
- metadata +43 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c25720b623362f9066503a5134f8e43bd657d55e
|
4
|
+
data.tar.gz: 6ef866902b3736eec018d0fef07ee4fe221a3d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 728bc4a4d5b8f6f3c7bf139d4fd7ca7678f98aa73b15388d55b851f8e0e9bcb5bb32f8a75626b20ab1a2b2a5c5b074537cbd024b1a20da8008b4a9d011bf0ebb
|
7
|
+
data.tar.gz: 78f163a2fa584dac08c8581ebfa8ad0464a92332618392704e1ae91b1ef3742b5fb5319721b83907b5c70e38eeade5545251e710cb8e86f1876172915bc069f9
|
data/.gitignore
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
.bundle
|
4
4
|
.config
|
5
5
|
.yardoc
|
6
|
+
.vagrant
|
6
7
|
Gemfile.lock
|
7
8
|
InstalledFiles
|
8
9
|
_yardoc
|
9
10
|
coverage
|
11
|
+
documentation
|
10
12
|
doc/
|
11
13
|
log/
|
12
14
|
lib/bundler/man
|
@@ -18,4 +20,5 @@ specs/version_tmp
|
|
18
20
|
specs/ksvalidator
|
19
21
|
tmp
|
20
22
|
test*
|
23
|
+
box/stork_pxe*
|
21
24
|
.DS_Store
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stork (0.
|
4
|
+
stork (0.2.0.pre)
|
5
5
|
highline
|
6
|
+
mixlib-config
|
6
7
|
rest-client
|
7
8
|
sinatra
|
8
9
|
sqlite3
|
9
|
-
|
10
|
+
webrick
|
10
11
|
|
11
12
|
GEM
|
12
13
|
remote: https://rubygems.org/
|
@@ -17,9 +18,7 @@ GEM
|
|
17
18
|
simplecov (>= 0.7)
|
18
19
|
term-ansicolor
|
19
20
|
thor
|
20
|
-
daemons (1.1.9)
|
21
21
|
docile (1.1.3)
|
22
|
-
eventmachine (1.0.3)
|
23
22
|
given_core (3.5.4)
|
24
23
|
sorcerer (>= 0.3.7)
|
25
24
|
highline (1.6.21)
|
@@ -30,6 +29,7 @@ GEM
|
|
30
29
|
minitest-given (3.5.4)
|
31
30
|
given_core (= 3.5.4)
|
32
31
|
minitest (> 4.3)
|
32
|
+
mixlib-config (2.1.0)
|
33
33
|
multi_json (1.9.2)
|
34
34
|
rack (1.5.2)
|
35
35
|
rack-protection (1.5.3)
|
@@ -52,13 +52,11 @@ GEM
|
|
52
52
|
sqlite3 (1.3.9)
|
53
53
|
term-ansicolor (1.3.0)
|
54
54
|
tins (~> 1.0)
|
55
|
-
thin (1.6.2)
|
56
|
-
daemons (>= 1.0.9)
|
57
|
-
eventmachine (>= 1.0.0)
|
58
|
-
rack (>= 1.0.0)
|
59
55
|
thor (0.19.1)
|
60
56
|
tilt (1.4.1)
|
61
57
|
tins (1.1.0)
|
58
|
+
webrick (1.3.1)
|
59
|
+
yard (0.8.7.4)
|
62
60
|
|
63
61
|
PLATFORMS
|
64
62
|
ruby
|
@@ -73,3 +71,4 @@ DEPENDENCIES
|
|
73
71
|
rake
|
74
72
|
simplecov
|
75
73
|
stork!
|
74
|
+
yard
|
data/README.md
CHANGED
@@ -5,27 +5,544 @@
|
|
5
5
|
|
6
6
|
Stork is a autoinstall utility, kickstart generation tool and server for CentOS and Redhat systems. It aims to fill the gap in the bare metal systems deployment that many of the other tools for cloud and virtual systems excel at.
|
7
7
|
|
8
|
+
##### ***Stork is currently under heavy development, but I hope to release the first stable version soon. Please be aware that the DSL and/or API may change significantly during this time.***
|
9
|
+
|
8
10
|
## Installation
|
9
11
|
|
10
12
|
Installation using rubygems:
|
11
13
|
|
12
|
-
$ gem install stork
|
14
|
+
$ gem install stork --pre
|
13
15
|
|
14
16
|
Install the latest version from the github:
|
15
17
|
|
16
18
|
$ git clone https://github.com/rlyon/stork.git
|
17
19
|
|
20
|
+
If you are installing the latest version from github, you have two choices to run stork. First, you can run ```rake install``` and build/install the gem, or you can run the executables direcly from the **bin** directory.
|
21
|
+
|
18
22
|
## Usage
|
19
23
|
|
20
24
|
### Control the server
|
21
25
|
storkctl start restart stop [options]
|
22
26
|
|
23
|
-
###
|
27
|
+
### Commands
|
28
|
+
stork host install [name]
|
24
29
|
stork host list
|
25
30
|
stork host localboot [name]
|
26
|
-
stork host
|
31
|
+
stork host reload
|
27
32
|
stork host show [name]
|
28
33
|
|
34
|
+
## Defining a host
|
35
|
+
|
36
|
+
### ```host```
|
37
|
+
|
38
|
+
#### Syntax:
|
39
|
+
|
40
|
+
The syntax for **host** is as follows:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
host "fqdn" do
|
44
|
+
attribute "value"
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
where
|
49
|
+
|
50
|
+
* ```fqdn``` is the fully qualified domain name of the host.
|
51
|
+
* ```attribute``` is the attributes available for this resource.
|
52
|
+
|
53
|
+
#### Attributes:
|
54
|
+
|
55
|
+
* ```layout``` - Disk layout containing partition and volume group information. You can supply a string or a block value. If a string is supplied stork will attempt to find the id matching a previously defined layout.
|
56
|
+
* ```template``` - The kickstart template to use when generating the autoinstallation instructions
|
57
|
+
* ```chef``` - Chef server information. You can supply a string or a block value. If a string is supplied stork will attempt to find the id matching a previously defined chef server.
|
58
|
+
* ```pxemac``` - The mac address of the PXE enabled interface. Used to create the boot configuration files.
|
59
|
+
* ```pre_snippet``` - Scripts that will be run in the **pre** section before the install begins. Snippets are accessed by the basename of the file they are stored in.
|
60
|
+
* ```post_snippet``` - Scripts that will be run in the **post** section afer the install has successfully completed. Snippets are accessed by the basename of the file they are stored in.
|
61
|
+
* ```interface``` - Network interface information. Takes only a block value.
|
62
|
+
* ```distro``` - Install distribution information. You can supply a string or a block value. If a string is supplied stork will attempt to find the id matching a previously defined distribution.
|
63
|
+
* ```timezone``` - The IANA zone name (e.g. 'America/Chicago').
|
64
|
+
* ```firewall``` - Initial firewall settings. Block only.
|
65
|
+
* ```selinux``` - String or symbol value representing the three selinux states. The only valid values are: enforcing, permissive, or disabled. Default is enforcing.
|
66
|
+
* ```package``` - Adds a package to the install. Generally not needed as the minimal set of packages that are installed by default will be enough to install the configuration management software.
|
67
|
+
* ```run_list``` - Chef runlist items that will populate the first-boot.json file. Can be an array or string value.
|
68
|
+
* ```chef_environment``` - A string value representing the chef environment the system is part of. Defaults to the '_default' environment.
|
69
|
+
* ```repos``` - Add a new repo to the host.
|
70
|
+
* ```stork``` - Url. Override the stork server location.
|
71
|
+
|
72
|
+
#### Examples:
|
73
|
+
|
74
|
+
Typical hosts will look like:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
host "server.example.org" do
|
78
|
+
template "default"
|
79
|
+
chef "default"
|
80
|
+
pxemac "00:11:22:33:44:55"
|
81
|
+
layout "home"
|
82
|
+
distro "centos"
|
83
|
+
repo "whamcloud-client", baseurl: "http://yum.example.com/eln/x86_64"
|
84
|
+
package "foo"
|
85
|
+
|
86
|
+
|
87
|
+
interface "eth0" do
|
88
|
+
bootproto :static
|
89
|
+
ip "99.99.1.8"
|
90
|
+
network "org"
|
91
|
+
end
|
92
|
+
|
93
|
+
interface "eth1" do
|
94
|
+
bootproto :static
|
95
|
+
ip "192.168.1.10"
|
96
|
+
netmask "255.255.255.0"
|
97
|
+
gateway "192.168.1.1"
|
98
|
+
nameserver "192.168.1.253"
|
99
|
+
nameserver "192.168.1.252"
|
100
|
+
end
|
101
|
+
|
102
|
+
pre_snippet "setup"
|
103
|
+
post_snippet "ntp"
|
104
|
+
post_snippet "resolv-conf"
|
105
|
+
post_snippet "chef-bootstrap"
|
106
|
+
post_snippet "chef-reconfigure"
|
107
|
+
post_snippet "notify"
|
108
|
+
|
109
|
+
run_list %w{ role[base] recipe[apache] }
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
Or you define hosts programatically with common ruby techniques:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
hosts=[
|
117
|
+
[10, "00:11:22:33:44:01"],
|
118
|
+
[11, "00:11:22:33:44:02"],
|
119
|
+
[12, "00:11:22:33:44:03"],
|
120
|
+
[13, "00:11:22:33:44:04"],
|
121
|
+
[14, "00:11:22:33:44:05"],
|
122
|
+
[15, "00:11:22:33:44:06"],
|
123
|
+
[16, "00:11:22:33:44:07"],
|
124
|
+
[17, "00:11:22:33:44:08"],
|
125
|
+
[18, "00:11:22:33:44:09"],
|
126
|
+
[19, "00:11:22:33:44:10"]
|
127
|
+
]
|
128
|
+
|
129
|
+
hosts.each do |octet, mac|
|
130
|
+
host "c0#{octet}.example.org" do
|
131
|
+
template "default"
|
132
|
+
chef "default"
|
133
|
+
distro "centos"
|
134
|
+
pxemac mac
|
135
|
+
layout "home"
|
136
|
+
|
137
|
+
|
138
|
+
interface "eth0" do
|
139
|
+
bootproto :static
|
140
|
+
ip "192.168.10.#{octet}"
|
141
|
+
network "org"
|
142
|
+
end
|
143
|
+
run_list %w{ role[node] }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
```
|
147
|
+
## Defining the disk layout
|
148
|
+
|
149
|
+
### ```layout```
|
150
|
+
|
151
|
+
#### Syntax:
|
152
|
+
|
153
|
+
The syntax for **layout** is as follows:
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
layout "name", part: "physical_volume" do
|
157
|
+
attribute "value"
|
158
|
+
end
|
159
|
+
```
|
160
|
+
|
161
|
+
where
|
162
|
+
|
163
|
+
* ```name``` is a unique name that can be used to define global resources that can be referenced from other resources by the defined name.
|
164
|
+
* ```part``` is the physical_volume that the volume group will be placed on.
|
165
|
+
* ```attribute``` is the attributes available for this resource.
|
166
|
+
|
167
|
+
#### Attributes:
|
168
|
+
|
169
|
+
* ```zerombr``` - Initialize invalid partition tables.
|
170
|
+
* ```clearpart``` - Remove partitions prior to the creation of new partitions.
|
171
|
+
* ```partition``` or ```part``` - Partition information (see Partition Resource).
|
172
|
+
* ```volume_group``` or ```vg``` - Volume group information (see Volume Group Resource).
|
173
|
+
|
174
|
+
### ```partition``` or ```part```
|
175
|
+
|
176
|
+
#### Syntax:
|
177
|
+
|
178
|
+
The syntax for **partition** is as follows:
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
partition "mountpoint" do
|
182
|
+
attribute "value"
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
where
|
187
|
+
|
188
|
+
* ```mountpoint``` is the filesystem path where the partition will be mounted. When a volume group will be associated with the partition, use the *pv.n* naming scheme to specify that the partition is a physical volume.
|
189
|
+
* ```attribute``` is the attributes available for this resource
|
190
|
+
|
191
|
+
#### Attributes:
|
192
|
+
|
193
|
+
* ```size``` - Size of the partition in MB.
|
194
|
+
* ```type``` - Set the file system type.
|
195
|
+
* ```primary``` - Force allocation of the partition as a primary partition.
|
196
|
+
* ```grow``` - Grow the partition to the maximum amount.
|
197
|
+
* ```recommended``` - Let the installer determine the recommended size.
|
198
|
+
|
199
|
+
See ```layout``` for an example of how partition can be used to define disk partitions.
|
200
|
+
|
201
|
+
### ```volume_group``` or ```volgroup```
|
202
|
+
|
203
|
+
#### Syntax:
|
204
|
+
|
205
|
+
The syntax for **volume_group** is as follows:
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
volume_group "name" do
|
209
|
+
block_attribute "value" do
|
210
|
+
attribute "value"
|
211
|
+
end
|
212
|
+
end
|
213
|
+
```
|
214
|
+
|
215
|
+
where
|
216
|
+
|
217
|
+
* ```name``` is the name of the volume group.
|
218
|
+
* ```attribute``` is the attributes available for this resource
|
219
|
+
|
220
|
+
#### Attributes:
|
221
|
+
|
222
|
+
* ```logical_volume``` - Add a logical volume to the volume group.
|
223
|
+
|
224
|
+
### ```logical_volume``` or ```logvol```
|
225
|
+
|
226
|
+
#### Syntax:
|
227
|
+
|
228
|
+
The syntax for **logical_volume** is as follows:
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
logical_volume "name" do
|
232
|
+
attribute "value"
|
233
|
+
end
|
234
|
+
```
|
235
|
+
|
236
|
+
where
|
237
|
+
|
238
|
+
* ```name``` is the name of the logical volume.
|
239
|
+
* ```attribute``` is the attributes available for this resource
|
240
|
+
|
241
|
+
#### Attributes:
|
242
|
+
|
243
|
+
* ```path``` - Mount point.
|
244
|
+
* ```size``` - Size of the logical volume in MB.
|
245
|
+
* ```type``` - Set the file system type.
|
246
|
+
* ```grow``` - Grow the logical volume to the maximum amount.
|
247
|
+
* ```recommended``` - Let the installer determine the recommended size.
|
248
|
+
|
249
|
+
#### Examples:
|
250
|
+
Layouts can be defined seperately from hosts and referenced in hosts by name. A typical layout will look like this:
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
layout "root_and_home" do
|
254
|
+
clearpart
|
255
|
+
zerombr
|
256
|
+
part "/boot" do
|
257
|
+
size 100
|
258
|
+
type "ext4"
|
259
|
+
primary
|
260
|
+
end
|
261
|
+
|
262
|
+
part "swap" do
|
263
|
+
recommended
|
264
|
+
type "swap"
|
265
|
+
primary
|
266
|
+
end
|
267
|
+
|
268
|
+
part "pv.01" do
|
269
|
+
grow
|
270
|
+
primary
|
271
|
+
end
|
272
|
+
|
273
|
+
volume_group "vg", part: "pv.01" do
|
274
|
+
logical_volume "lv_root" do
|
275
|
+
path "/"
|
276
|
+
type "ext4"
|
277
|
+
size 4096
|
278
|
+
end
|
279
|
+
|
280
|
+
logical_volume "lv_home" do
|
281
|
+
path "/home"
|
282
|
+
type "ext4"
|
283
|
+
grow
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
```
|
288
|
+
|
289
|
+
## Defining the install distribution
|
290
|
+
|
291
|
+
### ```distro```
|
292
|
+
|
293
|
+
#### Syntax:
|
294
|
+
|
295
|
+
The syntax for **distro** is as follows:
|
296
|
+
|
297
|
+
```ruby
|
298
|
+
distro "name" do
|
299
|
+
attribute "value"
|
300
|
+
end
|
301
|
+
```
|
302
|
+
|
303
|
+
where
|
304
|
+
|
305
|
+
* ```name``` is a unique name that can be used to define global resources that can be referenced from other resources by the defined name.
|
306
|
+
* ```attribute``` is the attributes available for this resource
|
307
|
+
|
308
|
+
#### Attributes:
|
309
|
+
|
310
|
+
* ```kernel``` - Name of the kernel. This is the kernel that will be transfered via tftp to the host at install time.
|
311
|
+
* ```image``` - Name of the RAM disk image of the installer.
|
312
|
+
* ```url``` - Install url for network install (only supports http - at least thats the only one I'm testing with)
|
313
|
+
|
314
|
+
#### Examples:
|
315
|
+
```ruby
|
316
|
+
distro "centos" do
|
317
|
+
kernel "vmlinuz"
|
318
|
+
image "initrd.img"
|
319
|
+
url "http://mirror.example.com/centos"
|
320
|
+
end
|
321
|
+
```
|
322
|
+
|
323
|
+
## Adding network interfaces
|
324
|
+
|
325
|
+
### ```network```
|
326
|
+
|
327
|
+
#### Syntax:
|
328
|
+
|
329
|
+
The syntax for **network** is as follows:
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
network "name" do
|
333
|
+
attribute "value"
|
334
|
+
end
|
335
|
+
```
|
336
|
+
|
337
|
+
where
|
338
|
+
|
339
|
+
* ```name``` is a unique name that can be used to define global resources that can be referenced from other resources by the defined name.
|
340
|
+
* ```attribute``` is one or more of the attributes available for this resource.
|
341
|
+
|
342
|
+
#### Attributes:
|
343
|
+
|
344
|
+
* ```netmask``` - the netmask of the network.
|
345
|
+
* ```gateway``` - the ip address of the network's gateway.
|
346
|
+
* ```nameserver``` - add a nameserver to the network.
|
347
|
+
* ```search_path``` - add a search_path to the network.
|
348
|
+
|
349
|
+
#### Examples:
|
350
|
+
|
351
|
+
```ruby
|
352
|
+
network "org" do
|
353
|
+
netmask "255.255.255.0"
|
354
|
+
gateway "99.99.1.1"
|
355
|
+
nameserver "99.99.1.253"
|
356
|
+
nameserver "99.99.1.252"
|
357
|
+
search_path "example.org"
|
358
|
+
end
|
359
|
+
|
360
|
+
```
|
361
|
+
|
362
|
+
### ```interface```
|
363
|
+
|
364
|
+
#### Syntax:
|
365
|
+
|
366
|
+
The syntax for **interface** is as follows:
|
367
|
+
|
368
|
+
```ruby
|
369
|
+
interface "device" do
|
370
|
+
attribute "value"
|
371
|
+
end
|
372
|
+
```
|
373
|
+
|
374
|
+
where
|
375
|
+
|
376
|
+
* ```device``` is the device that is being configured
|
377
|
+
* ```attribute``` is one or more of the attributes available for this resource.
|
378
|
+
|
379
|
+
#### Attributes:
|
380
|
+
|
381
|
+
* ```onboot``` - enables the interface on boot.
|
382
|
+
* ```ipv4``` or ```noipv4``` - enable or disable ipv4 support.
|
383
|
+
* ```ipv6``` or ```noipv6``` - enable or disable ipv6 support.
|
384
|
+
* ```defroute``` or ```nodefroute``` - use or don't use the interface for the default route.
|
385
|
+
* ```ethtool``` - a string value representing the ethtool options for the interface.
|
386
|
+
* ```bootproto``` - a string or symbol representing the boot protocol. Allowed values include :static and :dhcp.
|
387
|
+
|
388
|
+
For statically configured interfaces: ```bootproto :static```
|
389
|
+
|
390
|
+
* ```ip``` - the ip address of the interface.
|
391
|
+
* ```netmask``` - the netmask of the network.
|
392
|
+
* ```gateway``` - the ip address of the network's gateway.
|
393
|
+
* ```nameserver``` - add a nameserver to the network.
|
394
|
+
* ```search_path``` - add a search_path to the network.
|
395
|
+
* ```network``` - set the netmask, gateway, nameservers, and search paths with the values found in the specified network resource.
|
396
|
+
|
397
|
+
For dynamically configured interfaces: ```bootproto :dhcp```
|
398
|
+
|
399
|
+
* ```dns``` or ```nodns``` - allow or disallow dhcpd to update resolv.conf.
|
400
|
+
|
401
|
+
#### Examples:
|
402
|
+
|
403
|
+
```ruby
|
404
|
+
interface "eth0" do
|
405
|
+
onboot
|
406
|
+
bootproto :dhcp
|
407
|
+
end
|
408
|
+
|
409
|
+
interface "eth1" do
|
410
|
+
bootproto :static
|
411
|
+
ip "99.99.1.8"
|
412
|
+
network "org"
|
413
|
+
end
|
414
|
+
|
415
|
+
interface "eth2" do
|
416
|
+
bootproto :static
|
417
|
+
ip "192.168.1.10"
|
418
|
+
netmask "255.255.255.0"
|
419
|
+
gateway "192.168.1.1"
|
420
|
+
nameserver "192.168.1.253"
|
421
|
+
nameserver "192.168.1.252"
|
422
|
+
end
|
423
|
+
```
|
424
|
+
|
425
|
+
## Setting the host firewall
|
426
|
+
|
427
|
+
### ```firewall```
|
428
|
+
|
429
|
+
#### Syntax:
|
430
|
+
|
431
|
+
The syntax for **firewall** is as follows:
|
432
|
+
|
433
|
+
```ruby
|
434
|
+
firewall do
|
435
|
+
attribute "value"
|
436
|
+
end
|
437
|
+
```
|
438
|
+
|
439
|
+
where
|
440
|
+
|
441
|
+
* ```attribute``` is one or more of the attributes available for this resource.
|
442
|
+
|
443
|
+
#### Attributes:
|
444
|
+
|
445
|
+
* ```enabled``` - enable the firewall.
|
446
|
+
* ```disable``` - disable the firewall.
|
447
|
+
* ```ssh``` - allow the ssh protocol through the firewall.
|
448
|
+
* ```telnet``` - allow the telnet protocol through the firewall.
|
449
|
+
* ```smtp``` - allow the smtp protocol through the firewall.
|
450
|
+
* ```http``` - allow the http protocol through the firewall.
|
451
|
+
* ```ftp``` - allow the ftp protocol through the firewall.
|
452
|
+
* ```trust``` - add a device (e.g. eth1, eth2, p1p2, etc) as a trusted device.
|
453
|
+
* ```allow``` - allow a port and using the **port:protocol** format
|
454
|
+
|
455
|
+
#### Examples:
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
firewall do
|
459
|
+
enabled
|
460
|
+
ssh
|
461
|
+
allow "8080:tcp"
|
462
|
+
trust "eth1"
|
463
|
+
end
|
464
|
+
```
|
465
|
+
|
466
|
+
## Defining the chef resources
|
467
|
+
|
468
|
+
### ```chef```
|
469
|
+
|
470
|
+
#### Syntax:
|
471
|
+
|
472
|
+
The syntax for the **chef** resource is as follows:
|
473
|
+
|
474
|
+
```ruby
|
475
|
+
chef "name" do
|
476
|
+
attribute "value"
|
477
|
+
end
|
478
|
+
```
|
479
|
+
|
480
|
+
where
|
481
|
+
|
482
|
+
* ```name``` is a unique name that can be used to define global resources that can be referenced from other resources by the defined name.
|
483
|
+
* ```attribute``` is the attributes available for this resource
|
484
|
+
|
485
|
+
#### Attributes:
|
486
|
+
|
487
|
+
* ```version``` - The version of chef to use.
|
488
|
+
* ```client_name``` - The admin client name.
|
489
|
+
* ```client_key``` - The admin client key file.
|
490
|
+
* ```validator_name``` - The validation client name.
|
491
|
+
* ```validation_key``` - The validation key file.
|
492
|
+
* ```encrypted_data_bag_secret``` - A string value of the data bag encryption key.
|
493
|
+
|
494
|
+
#### Examples:
|
495
|
+
|
496
|
+
```ruby
|
497
|
+
chef "default" do
|
498
|
+
url "https://chef.example.org"
|
499
|
+
version "11.6.0"
|
500
|
+
client_name "root"
|
501
|
+
client_key "./specs/keys/snakeoil-root.pem"
|
502
|
+
validator_name "chef-validator"
|
503
|
+
validation_key "./specs/keys/snakeoil-validation.pem"
|
504
|
+
encrypted_data_bag_secret "9EE8rGyPB8mXARNrzSDal9TOAQ...e7/x2uPkqMS/tOU="
|
505
|
+
end
|
506
|
+
```
|
507
|
+
|
508
|
+
## Templates and Snippet Scripts
|
509
|
+
|
510
|
+
Templates and snippets use the ERB templating system. When the ERB files are rendered, binding are created to expose ruby the underlying ruby objects.
|
511
|
+
|
512
|
+
In kickstart templates, the generated kickstart commands can be accessed:
|
513
|
+
|
514
|
+
* ```url``` - Outputs the kickstart command assigning the URL for network installs.
|
515
|
+
* ```network``` - Outputs each interface kickstart command for all defined interfaces.
|
516
|
+
* ```password``` - Outputs the 'rootpw' command with a randomized password.
|
517
|
+
* ```firewall``` - Outputs the firewall command.
|
518
|
+
* ```timezone``` - Outputs the timezone command for the installer.
|
519
|
+
* ```selinux``` - Outputs the selinux command.
|
520
|
+
* ```layout``` - Outputs all of the partition, volume groups and logical volume commands.
|
521
|
+
* ```bootloader``` - Outputs the bootloader config information.
|
522
|
+
* ```zerombr``` - Outputs the zerombr command.
|
523
|
+
* ```clearpart``` - Outputs the clearpart command.
|
524
|
+
* ```repos``` - Outputs all additional repo commands.
|
525
|
+
* ```packages``` - Outputs the packages section.
|
526
|
+
* ```pre_snippets``` - Renders and outputs all pre snippets in the %pre section.
|
527
|
+
* ```post_snippets``` - Renders and outputs all post snippets in the %post section.
|
528
|
+
|
529
|
+
In addition to the kickstart command generators, the following objects are exposed and can be used:
|
530
|
+
|
531
|
+
* ```host``` - The complete host object for the current host.
|
532
|
+
|
533
|
+
Snippets expose the following objects to the template:
|
534
|
+
|
535
|
+
* ```host``` - The current host.
|
536
|
+
* ```chef``` - The chef object.
|
537
|
+
* ```authorized_keys``` - A string containing all the public keys.
|
538
|
+
* ```first_boot_content``` - A string representation of the json content that will make up the first_boot file.
|
539
|
+
* ```nameservers``` - An array of all unique nameservers.
|
540
|
+
* ```search_paths``` - An array of all unique search_paths.
|
541
|
+
* ```stork_server``` - The IP address or hostname of the stork server.
|
542
|
+
* ```stork_port``` - The port that the stork server is running on.
|
543
|
+
* ```stork_bind``` - The bind IP address of the stork server.
|
544
|
+
|
545
|
+
|
29
546
|
## Contributing
|
30
547
|
|
31
548
|
### Grab the source and make a branch
|
@@ -36,7 +553,7 @@ Install the latest version from the github:
|
|
36
553
|
4. Push to the branch (`git push origin my-new-feature`)
|
37
554
|
5. Create new Pull Request
|
38
555
|
|
39
|
-
###
|
556
|
+
### Setting up for the kickstart validation tests
|
40
557
|
|
41
558
|
To run the kickstart validation tests on your local system, you
|
42
559
|
will need to install python and the python virtualenv module.
|
data/bin/stork
CHANGED
@@ -18,13 +18,20 @@ require 'ostruct'
|
|
18
18
|
class StorkApp
|
19
19
|
def initialize
|
20
20
|
@options = OpenStruct.new
|
21
|
-
@options.config = "
|
21
|
+
@options.config = ENV['STORK_CONFIG'] || "#{ENV['HOME']}/.stork/client.rb"
|
22
|
+
@options.debug = false
|
22
23
|
|
23
24
|
@opts = OptionParser.new do |o|
|
24
25
|
o.banner = "Usage: stork sub-command action [options]"
|
25
26
|
o.on("-c", "--config FILE", "Read configuration from the specified file") do |config|
|
26
27
|
@options.config = config
|
27
28
|
end
|
29
|
+
o.on("-D", "--debug", "Turn on debug output") do
|
30
|
+
@options.debug = true
|
31
|
+
end
|
32
|
+
o.on("-h", "--help", "Print this help message") do
|
33
|
+
help
|
34
|
+
end
|
28
35
|
end
|
29
36
|
end
|
30
37
|
|
@@ -42,6 +49,7 @@ class StorkApp
|
|
42
49
|
|
43
50
|
# Probably not the best way to keep track
|
44
51
|
def plugins
|
52
|
+
puts Module.constants if @options.debug
|
45
53
|
Module.constants.select{|m| m =~ /Plugin/}
|
46
54
|
end
|
47
55
|
|
@@ -57,16 +65,15 @@ class StorkApp
|
|
57
65
|
action_name = action.to_s.capitalize
|
58
66
|
|
59
67
|
opt_parse
|
60
|
-
|
68
|
+
load_or_create_config
|
69
|
+
|
61
70
|
plugin_name = "#{sub_command_name}#{action_name}"
|
62
71
|
module_name = "#{plugin_name}Plugin"
|
63
72
|
constant_name = "#{module_name}::#{plugin_name}"
|
64
73
|
|
65
74
|
begin
|
66
75
|
klass = Stork.const_get(constant_name)
|
67
|
-
|
68
|
-
configuration = Stork::Configuration.from_file(@options.config)
|
69
|
-
@plugin = klass.new(configuration, @options, ARGV)
|
76
|
+
@plugin = klass.new(@options, ARGV)
|
70
77
|
rescue NameError => err
|
71
78
|
help "Unknown sub-command"
|
72
79
|
rescue Errno::ENOENT => err
|
@@ -79,6 +86,13 @@ class StorkApp
|
|
79
86
|
@opts.parse!
|
80
87
|
end
|
81
88
|
|
89
|
+
def load_or_create_config
|
90
|
+
unless File.exist?(@options.config)
|
91
|
+
help "Your configuration file was not found at: #{@options.config}"
|
92
|
+
end
|
93
|
+
Stork::Configuration.from_file(@options.config)
|
94
|
+
end
|
95
|
+
|
82
96
|
def run
|
83
97
|
begin
|
84
98
|
@plugin.run
|