dop_common 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +176 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +177 -0
- data/README.md +48 -0
- data/Rakefile +49 -0
- data/Vagrantfile +25 -0
- data/bin/dop-puppet-autosign +56 -0
- data/doc/examples/example_deploment_plan_v0.0.1.yaml +302 -0
- data/doc/plan_format_v0.0.1.md +919 -0
- data/doc/plan_format_v0.0.2_snippets.md +56 -0
- data/dop_common.gemspec +44 -0
- data/lib/dop_common/affinity_group.rb +57 -0
- data/lib/dop_common/cli/global_options.rb +37 -0
- data/lib/dop_common/cli/log.rb +51 -0
- data/lib/dop_common/cli/node_selection.rb +62 -0
- data/lib/dop_common/command.rb +125 -0
- data/lib/dop_common/config/helper.rb +39 -0
- data/lib/dop_common/config.rb +66 -0
- data/lib/dop_common/configuration.rb +37 -0
- data/lib/dop_common/credential.rb +152 -0
- data/lib/dop_common/data_disk.rb +62 -0
- data/lib/dop_common/dns.rb +55 -0
- data/lib/dop_common/hash_parser.rb +241 -0
- data/lib/dop_common/hooks.rb +81 -0
- data/lib/dop_common/infrastructure.rb +160 -0
- data/lib/dop_common/infrastructure_properties.rb +185 -0
- data/lib/dop_common/interface.rb +113 -0
- data/lib/dop_common/log.rb +78 -0
- data/lib/dop_common/network.rb +85 -0
- data/lib/dop_common/node/config.rb +159 -0
- data/lib/dop_common/node.rb +442 -0
- data/lib/dop_common/node_filter.rb +74 -0
- data/lib/dop_common/plan.rb +188 -0
- data/lib/dop_common/plan_cache.rb +83 -0
- data/lib/dop_common/plan_store.rb +263 -0
- data/lib/dop_common/pre_processor.rb +73 -0
- data/lib/dop_common/run_options.rb +56 -0
- data/lib/dop_common/signal_handler.rb +58 -0
- data/lib/dop_common/state_store.rb +95 -0
- data/lib/dop_common/step.rb +200 -0
- data/lib/dop_common/step_set.rb +41 -0
- data/lib/dop_common/thread_context_logger.rb +77 -0
- data/lib/dop_common/utils.rb +106 -0
- data/lib/dop_common/validator.rb +53 -0
- data/lib/dop_common/version.rb +3 -0
- data/lib/dop_common.rb +32 -0
- data/lib/hiera/backend/dop_backend.rb +94 -0
- data/lib/hiera/dop_logger.rb +20 -0
- data/spec/data/fake_hook_file_invalid +1 -0
- data/spec/data/fake_hook_file_valid +5 -0
- data/spec/data/fake_keyfile +1 -0
- data/spec/dop-puppet-autosign_spec_disable.rb +33 -0
- data/spec/dop_common/affinity_group_spec.rb +41 -0
- data/spec/dop_common/command_spec.rb +83 -0
- data/spec/dop_common/credential_spec.rb +73 -0
- data/spec/dop_common/data_disk_spec.rb +165 -0
- data/spec/dop_common/dns_spec.rb +33 -0
- data/spec/dop_common/hash_parser_spec.rb +181 -0
- data/spec/dop_common/hooks_spec.rb +33 -0
- data/spec/dop_common/infrastructure_properties_spec.rb +224 -0
- data/spec/dop_common/infrastructure_spec.rb +77 -0
- data/spec/dop_common/interface_spec.rb +192 -0
- data/spec/dop_common/network_spec.rb +92 -0
- data/spec/dop_common/node_filter_spec.rb +70 -0
- data/spec/dop_common/node_spec.rb +623 -0
- data/spec/dop_common/plan_cache_spec.rb +46 -0
- data/spec/dop_common/plan_spec.rb +136 -0
- data/spec/dop_common/plan_store_spec.rb +194 -0
- data/spec/dop_common/pre_processor_spec.rb +27 -0
- data/spec/dop_common/run_options_spec.rb +65 -0
- data/spec/dop_common/signal_handler_spec.rb +31 -0
- data/spec/dop_common/step_set_spec.rb +21 -0
- data/spec/dop_common/step_spec.rb +175 -0
- data/spec/dop_common/utils_spec.rb +27 -0
- data/spec/dop_common/validator_spec.rb +47 -0
- data/spec/example_plans_spec.rb +16 -0
- data/spec/fixtures/example_ssh_key +27 -0
- data/spec/fixtures/example_ssh_key.pub +1 -0
- data/spec/fixtures/incl/root_part.yaml +1 -0
- data/spec/fixtures/incl/some_list.yaml +2 -0
- data/spec/fixtures/other_plan_same_nodes.yaml +19 -0
- data/spec/fixtures/simple_include.yaml +6 -0
- data/spec/fixtures/simple_include_with_errors.yaml +4 -0
- data/spec/fixtures/simple_plan.yaml +19 -0
- data/spec/fixtures/simple_plan_invalid.yaml +18 -0
- data/spec/fixtures/simple_plan_modified.yaml +21 -0
- data/spec/spec_helper.rb +106 -0
- metadata +381 -0
@@ -0,0 +1,919 @@
|
|
1
|
+
# DOP Plan Format v 0.0.1
|
2
|
+
|
3
|
+
The DOP Plan file consists out of series of hashes and arrays which describe
|
4
|
+
system of nodes that should be created and a list of steps that need to be
|
5
|
+
performed on this nodes in order.
|
6
|
+
|
7
|
+
## Includes
|
8
|
+
|
9
|
+
From DOPi >= 0.16, DOPv >= 0.8 on the DOP plan format supports includes. Before
|
10
|
+
DOP will parse the plan there is now a preprocessor step which will replace all
|
11
|
+
"include: <file>" statements with the content of the file.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
|
15
|
+
name: 'my_plan'
|
16
|
+
include: '/etc/dop_deployments/credentials.yaml'
|
17
|
+
include: 'nodes.yaml'
|
18
|
+
|
19
|
+
steps:
|
20
|
+
default:
|
21
|
+
include: 'openstack_deploy_steps.yaml'
|
22
|
+
patch:
|
23
|
+
include: '/etc/dop_deployments/generic_patch_maintenance_steps.yaml'
|
24
|
+
|
25
|
+
The file path can either be a relative or an absolute path. Relative paths mean
|
26
|
+
that the preprocessor will look for the file relative to the path of the file
|
27
|
+
which is including it. Included files can itself include files.
|
28
|
+
|
29
|
+
The content of the included file will be placed at the position where the include
|
30
|
+
statement begins with the exact same identation for every line.
|
31
|
+
|
32
|
+
## Global settings
|
33
|
+
|
34
|
+
Settings that influence the whole plan
|
35
|
+
|
36
|
+
### name (optional)
|
37
|
+
|
38
|
+
The name of the plan. Make sure this name is unique among all your plan you try
|
39
|
+
to add on the same node. DOP will use this name as filename to store the plan data.
|
40
|
+
The name may only contain letters, numbers and underscores.
|
41
|
+
|
42
|
+
If no name is given, DOP will calculate the SHA2 of the plan content and use this
|
43
|
+
as a name (you will not be able to update such a plan).
|
44
|
+
|
45
|
+
### max_in_flight (optional)
|
46
|
+
|
47
|
+
`default: 3`
|
48
|
+
|
49
|
+
The amount of nodes DOPi will be executing commands on and DOPv will depoly in parallel.
|
50
|
+
|
51
|
+
There are also two special values:
|
52
|
+
|
53
|
+
- The value "0" will disable thread spawning for debug purposes.
|
54
|
+
- The value "-1" will spawn as many threads as there are nodes.
|
55
|
+
|
56
|
+
This option can be overwritten on step level for DOPi and on infrastructure level for DOPv
|
57
|
+
|
58
|
+
### max_per_role (optional)
|
59
|
+
|
60
|
+
`default: -1`
|
61
|
+
|
62
|
+
The amount of nodes per role DOPi will execute in parallel.
|
63
|
+
|
64
|
+
There are also two special values:
|
65
|
+
|
66
|
+
- The values "0" and "-1" will make DOPi ignore the roles.
|
67
|
+
|
68
|
+
This option can be overwritten on step level
|
69
|
+
|
70
|
+
### canary_host (optional)
|
71
|
+
|
72
|
+
`default: false`
|
73
|
+
|
74
|
+
If this flag is set to true DOPi will randomly choose one host and apply the step in a first round only to this host and only run the others in parallel, once this step succeeded.
|
75
|
+
|
76
|
+
This option can be overwritten on step level
|
77
|
+
|
78
|
+
## Credentials
|
79
|
+
The credentials hash can hold credentials used to login to systems, APIs or to set passwords or keys during setup.
|
80
|
+
|
81
|
+
Example:
|
82
|
+
```yaml
|
83
|
+
credentials:
|
84
|
+
'linux_staging_login':
|
85
|
+
type: :username_password
|
86
|
+
username: 'root'
|
87
|
+
password: 'foo'
|
88
|
+
'linux_prod_login':
|
89
|
+
type: :ssh_key
|
90
|
+
private_key: '/home/root/.ssh/id_dsa'
|
91
|
+
'windows_staging_login':
|
92
|
+
type: :username_password
|
93
|
+
username: 'administrator'
|
94
|
+
password: 'winfoo'
|
95
|
+
'windows_prod_login':
|
96
|
+
type: :kerberos
|
97
|
+
realm: 'FOOOO'
|
98
|
+
```
|
99
|
+
|
100
|
+
The various DOPi plugins can use these credentials to login to a node if the type is supported by the plugin.
|
101
|
+
It is recommended to use the set_plugin_defaults mechanic to set this credentials so it does not have to be
|
102
|
+
specified in every command separately. You can also change this defaults in your steps flow.
|
103
|
+
|
104
|
+
### Credential types
|
105
|
+
|
106
|
+
The credential types and the fields you can specify are listed here
|
107
|
+
|
108
|
+
#### username_password
|
109
|
+
A simple username password pair.
|
110
|
+
|
111
|
+
1. __*username*__ (required)
|
112
|
+
2. __*password*__ (required)
|
113
|
+
|
114
|
+
#### kerberos
|
115
|
+
Settings for a kerberos login
|
116
|
+
|
117
|
+
1. __*realm*__ (required) - The kerberos realm
|
118
|
+
2. __*service*__ (optional) - The service we try to use
|
119
|
+
3. __*keytab*__ (optional) - The keytab file to use instead of the default one
|
120
|
+
|
121
|
+
#### ssh_key
|
122
|
+
And SSH key we can use to login
|
123
|
+
|
124
|
+
1. __*username*__ (required)
|
125
|
+
2. __*private_key*__ (optional)
|
126
|
+
3. __*public_key*__ (optional)
|
127
|
+
|
128
|
+
While the public_key and private_key are optional in general, they are required depending on the usage of the
|
129
|
+
credential. If the credential is used in DOPi to login to ssh, a private key will be required and the parser will
|
130
|
+
inform you of this. If the credential is used in DOPv to set the login credentials of a vm, a public_key will be
|
131
|
+
required.
|
132
|
+
|
133
|
+
public_key and private_key can both be specified inline or be read from a file. Check the documentation about
|
134
|
+
[external secrets](#external-secrets) about how to specify this correctly.
|
135
|
+
|
136
|
+
### External secrets
|
137
|
+
|
138
|
+
Secrets like passwords or keys can be stored outside of the plan so you don't have to check them into version control.
|
139
|
+
Instead of the password you can specify a hash with only one key-value pair. The key is either :file or :exec.
|
140
|
+
The value for :file is a simple file which will be read to get the password. For :exec it is an array of where
|
141
|
+
the first entry is the executable and the rest is a bunch of options or arguments which will be joined together
|
142
|
+
and passed to the executable on the command line.
|
143
|
+
|
144
|
+
credentials:
|
145
|
+
'linux_staging_login':
|
146
|
+
type: :username_password
|
147
|
+
username: 'root'
|
148
|
+
password:
|
149
|
+
file: '/path/to/my_external_secret'
|
150
|
+
'linux_prod_password':
|
151
|
+
type: :username_password
|
152
|
+
username: 'root'
|
153
|
+
password:
|
154
|
+
exec: ['/path/to/my_external_secret', '--some-option', 'arg1']
|
155
|
+
|
156
|
+
## Hooks
|
157
|
+
Hooks can be defined as a hash of programs that will be called before and/or
|
158
|
+
after a node is created and/or updated and/or destroyed.
|
159
|
+
|
160
|
+
A hook consists of an array of strings that represent paths to programs to be
|
161
|
+
be executed at particular deployment stage.
|
162
|
+
|
163
|
+
Following is a list of supported hooks:
|
164
|
+
- `pre_create_vm` - a set of programs executed before node creation.
|
165
|
+
- `post_create_vm` - a set of programs executed after node creation.
|
166
|
+
- `pre_update_vm` - a set programs executed before node update.
|
167
|
+
- `post_update_vm` - a set of programs executed after node is update.
|
168
|
+
- `pre_destroy_vm` - a set of programs executed before node removal.
|
169
|
+
- `post_destroy_vm` - a set of programs executed after node removal.
|
170
|
+
|
171
|
+
__IMPORTANT__:
|
172
|
+
- FQDN of the given node is passed to program(s) as the first argument.
|
173
|
+
- `0` or `1` is passed to program(s) as the second argument. More
|
174
|
+
specifically, `0` is passed if there were no changes of the node during
|
175
|
+
deployment, while `1` indicates that there were some changes.
|
176
|
+
- Programs are executed in the order of their definition in the deployment
|
177
|
+
plan.
|
178
|
+
- Each hook type definition is optional, however, `hooks` hash must contain
|
179
|
+
at least one hook type.
|
180
|
+
|
181
|
+
Following is an example of hooks definition
|
182
|
+
```yaml
|
183
|
+
hooks:
|
184
|
+
pre_create_vm:
|
185
|
+
- /path/to/pre_create_program_1
|
186
|
+
- /path/to/pre_create_program_2
|
187
|
+
post_create_vm:
|
188
|
+
- /path/to/post_create_program_1
|
189
|
+
pre_update_vm:
|
190
|
+
- /path/to/pre_update_program_1
|
191
|
+
post_update_vm:
|
192
|
+
- /path/to/post_update_program_2
|
193
|
+
pre_destroy_vm:
|
194
|
+
- /path/to/pre_destroy_program_1
|
195
|
+
- /path/to/pre_destroy_program_2
|
196
|
+
- /path/to/pre_destroy_program_3
|
197
|
+
post_destroy_vm:
|
198
|
+
- /path/to/post_destroy_program_1
|
199
|
+
```
|
200
|
+
|
201
|
+
## Infrastructures
|
202
|
+
The infrastructures hash holds information about cloud providers. Each entry in
|
203
|
+
an infrastructures hash describes a certain infrastructure or cloud if you want.
|
204
|
+
It is of hash type. Following is a list of keys:
|
205
|
+
1. __*type*__ - is the type of the infrastructure provider. It is a reuired
|
206
|
+
property. The infrastructure provider type can be specified by following values:
|
207
|
+
- *baremetal*,
|
208
|
+
- *ovirt* or *rhev*,
|
209
|
+
- *openstack*,
|
210
|
+
- *vsphere* or *vmware*.
|
211
|
+
|
212
|
+
Please note that *rhev* and *ovirt* are synonyms and so are *vsphere* and *vmware*.
|
213
|
+
|
214
|
+
2. __*endpoint*__ - is an URL that is an entry point for API calls.
|
215
|
+
|
216
|
+
__IMPORTANT__: This property is required unless the provider type is *baremetal*.
|
217
|
+
|
218
|
+
3. __*credentials*__ - A pointer to an entry in credentials hash. Please refer
|
219
|
+
to credentials section above for further for further information.
|
220
|
+
|
221
|
+
__IMPORTANT__: Currently, only one credentials provider is required and
|
222
|
+
supported for infrastructure. The credentials must be of
|
223
|
+
__*username_password*__ type.
|
224
|
+
|
225
|
+
__IMPORTANT__: This property is required unless the provider type is *baremetal*.
|
226
|
+
|
227
|
+
4. __*networks*__ - provides networks definition hashes. Each network
|
228
|
+
definition is hashed by its name that can be an arbitrary string or symbol.
|
229
|
+
Please refer to network subsection for further details.
|
230
|
+
|
231
|
+
__IMPORTANT__: This property is required unless the provider type is *baremetal*.
|
232
|
+
|
233
|
+
5. __*affinity_groups*__ - provides affinity groups definition hashes. Each
|
234
|
+
affinity group definition itself is a hash. Affinity groups may be provider
|
235
|
+
specific. For instance, OVirt/RHEVm infrastructure must define __*name*__,
|
236
|
+
__*cluster*__, __*positive*__ and __*enforced*__ properties. Please note
|
237
|
+
that some providers may not have affinities implemented, hence this feature
|
238
|
+
is optional in deployment plan.
|
239
|
+
|
240
|
+
The following snippet is an example infrastructures configuration:
|
241
|
+
```yaml
|
242
|
+
infrastructures:
|
243
|
+
management:
|
244
|
+
type: rhev
|
245
|
+
endpoint: https://rhev.example.com/api/
|
246
|
+
credentials: rhev_api_login
|
247
|
+
networks:
|
248
|
+
management:
|
249
|
+
ip_pool:
|
250
|
+
from: 192.168.254.11
|
251
|
+
to: 192.168.254.245
|
252
|
+
ip_netmask: 255.255.255.0
|
253
|
+
ip_defgw: 192.168.254.254
|
254
|
+
production:
|
255
|
+
ip_pool:
|
256
|
+
from: 192.168.1.11
|
257
|
+
to: 192.168.1.245
|
258
|
+
ip_netmask: 255.255.255.0
|
259
|
+
ip_defgw: 192.168.1.254
|
260
|
+
affinity_groups:
|
261
|
+
clu-lab1ch-ag_1:
|
262
|
+
positive: true
|
263
|
+
enforce: true
|
264
|
+
cluster: clu-lab1ch
|
265
|
+
clu-lab1ch-ag_2:
|
266
|
+
positive: true
|
267
|
+
enforce: false
|
268
|
+
cluster: clu-lab1ch
|
269
|
+
clu-lab1ch-ag_3:
|
270
|
+
positive: false
|
271
|
+
enforce: true
|
272
|
+
cluster: clu-lab1ch
|
273
|
+
lamp:
|
274
|
+
type: openstack
|
275
|
+
endpoint: https://openstack.example.com/api/
|
276
|
+
credentials: openstack_api_login
|
277
|
+
networks:
|
278
|
+
management-subnet:
|
279
|
+
ip_pool:
|
280
|
+
from: 192.168.253.11
|
281
|
+
to: 192.168.253.245
|
282
|
+
ip_netmask: 255.255.255.0
|
283
|
+
ip_defgw: 192.168.253.254
|
284
|
+
production-subnet:
|
285
|
+
ip_pool:
|
286
|
+
from: 192.168.2.11
|
287
|
+
to: 192.168.2.245
|
288
|
+
ip_netmask: 255.255.255.0
|
289
|
+
ip_defgw: 192.168.2.254
|
290
|
+
db:
|
291
|
+
type: vsphere
|
292
|
+
endpoint: https://vsphere.example.com/api/
|
293
|
+
credentials: vsphere_api_login
|
294
|
+
networks:
|
295
|
+
management:
|
296
|
+
ip_pool:
|
297
|
+
from: 192.168.252.11
|
298
|
+
to: 192.168.252.245
|
299
|
+
ip_netmask: 255.255.255.0
|
300
|
+
ip_defgw: 192.168.252.254
|
301
|
+
production:
|
302
|
+
ip_pool:
|
303
|
+
from: 192.168.3.11
|
304
|
+
to: 192.168.3.245
|
305
|
+
ip_netmask: 255.255.255.0
|
306
|
+
ip_defgw: 192.168.3.254
|
307
|
+
```
|
308
|
+
|
309
|
+
### Network
|
310
|
+
The network hash describes a particular network within a given infrastructure
|
311
|
+
provider (cloud). Following are the properties of a network hash:
|
312
|
+
1. __*ip_pool*__ - a hash of IP addresses which can be assigned to guest VMs.
|
313
|
+
The hash must contain __*ip_from*__ and __*ip_to*__ keywords that specify
|
314
|
+
the lower and upper bounds of IP addresses that can be assigned statically.
|
315
|
+
2. __*ip_netmask*__ - a network mask in octet format.
|
316
|
+
3. __*ip_defgw*__ - an IP address of the default gateway of the network.
|
317
|
+
|
318
|
+
__NOTE__: One might also specify an empty hash `{}` as netwrok properties in
|
319
|
+
case of pure DHCP or NONE-based networks.
|
320
|
+
|
321
|
+
__IMPORTANT__: Please note that network names must refer to sub-network names
|
322
|
+
or their identifiers in case of [OpenStack](http://www.openstack.org/) based
|
323
|
+
infrastructures.
|
324
|
+
|
325
|
+
## Nodes
|
326
|
+
|
327
|
+
The nodes hash holds the basic information about all nodes you want to create
|
328
|
+
and use. Each entry in the nodes hash is itself a hash. A single entry of this
|
329
|
+
is called a node hash (singular). Each node hash starts with the node name as a
|
330
|
+
key:
|
331
|
+
|
332
|
+
```yaml
|
333
|
+
nodes:
|
334
|
+
mysql01.example.com:
|
335
|
+
...
|
336
|
+
...
|
337
|
+
...
|
338
|
+
```
|
339
|
+
|
340
|
+
__IMPORTANT__: The node name must be unique for each deployment. Please keep
|
341
|
+
this in mind when combining several deployments into a single deployment file.
|
342
|
+
|
343
|
+
### Node Properties
|
344
|
+
Each node configuration is described by a so-called *"node hash"*. The list
|
345
|
+
bellow provides an overview of various node properties. Please note that
|
346
|
+
a property name is actually a keyword of a node hash.
|
347
|
+
|
348
|
+
1. __*fqdn*__ - an optional fully qualified domain name that is used to
|
349
|
+
generate the hostname of the guest. If not defined, the hostname is implicitly
|
350
|
+
derived from the node name itself (for instance, in case of
|
351
|
+
`mgt01.example.com`, the hostname definition would match the node name, i.e.
|
352
|
+
`mgt01.example.com`).
|
353
|
+
|
354
|
+
2. __*infrastructure*__ - a name of the infrastructure this node is a part of.
|
355
|
+
This is a required property and its value must point to a valid entry of
|
356
|
+
infrastructures hash.
|
357
|
+
|
358
|
+
3. __*infrastructure_properties*__ - a hash that specifies various properties
|
359
|
+
of a given node should be deployed with in an infrastructure.
|
360
|
+
|
361
|
+
1. __*affinity_groups*__ - an optional OVirt/RHEVm-specific property that
|
362
|
+
designates what affinity groups should be a node associated with.
|
363
|
+
|
364
|
+
2. __*keep_ha*__ - an optional OVirt/RHEVm-specific boolean property that
|
365
|
+
indicates whether the VM should be highly available or not. By default,
|
366
|
+
instances are set as highly available. If the provider also supports a
|
367
|
+
migration priorities they are set to low by default.
|
368
|
+
|
369
|
+
3. __*datacenter*__ and __*cluster*__ - Specify which datacenter and cluster
|
370
|
+
should be the node deployed into.
|
371
|
+
|
372
|
+
__IMPORTANT__: These properties are required for provider OVirt/RHEVm and
|
373
|
+
VSphere providers. Other providers silently disregard it.
|
374
|
+
|
375
|
+
4. __*default_pool*__ - property specifies the default data storage which is
|
376
|
+
used when deploying a guest from the template. It is also used for persistent
|
377
|
+
disks that do not specify an explicit __*pool*__. This attribute is optional.
|
378
|
+
|
379
|
+
5. __*dest_folder*__ property defines a destination folder into which the
|
380
|
+
guest shall be deployed. This folder must exist before the deployment
|
381
|
+
of the guest. This is propery is optional and VSphere-specific.
|
382
|
+
|
383
|
+
6. __*tenant*__ property specifies the name of the tenant for OpenStack
|
384
|
+
infrastructures. It is required for OpenStack infrastructures.
|
385
|
+
|
386
|
+
7. __*use_config_drive*__ an optional OpenStack-specific boolean property
|
387
|
+
that specifies whether a config drive should be used for VM
|
388
|
+
provisioning. If set to `false` or indefined, metadata service is
|
389
|
+
used. If set to `true` config drive is used.
|
390
|
+
|
391
|
+
8. __*domain_id*__ an optional property specifies the name of the domain ID
|
392
|
+
for OpenStack infrastructures. It defaults to `default`.
|
393
|
+
|
394
|
+
9. __*endpoint_type*__ an optional property specifies the endpoint type
|
395
|
+
for OpenStack infrastructures. Accepted values are `publicURL`,
|
396
|
+
`internalURL` and `adminURL`. It defaults to `publicURL`.
|
397
|
+
|
398
|
+
__IMPORTANT__: Infrastructure properties may differ across different
|
399
|
+
provider types.
|
400
|
+
|
401
|
+
__IMPORTANT__: In general, some of infrastructure properties have to be
|
402
|
+
defined for each provider other than *baremetal*.
|
403
|
+
|
404
|
+
4. __*image*__ - an image to deploy the node from (a.k.a template). An image
|
405
|
+
must be registered within the provider.
|
406
|
+
|
407
|
+
__IMPORTANT__: This property is required unless the provider type is
|
408
|
+
*baremetal*.
|
409
|
+
|
410
|
+
5. __*full_clone*__ - an optional boolean property that instructs OVirt/RHEVm
|
411
|
+
providers:
|
412
|
+
1. To provision a node from a template as a full independent clone if set to
|
413
|
+
`true` or unset.
|
414
|
+
|
415
|
+
2. To provision a node from a template as thin (dependent) clone if set to
|
416
|
+
`false`.
|
417
|
+
|
418
|
+
The default is to provision a fully independent clone.
|
419
|
+
|
420
|
+
__IMPORTANT__: Do not use this property for other cloud provider types than
|
421
|
+
OVirt/RHEVm.
|
422
|
+
|
423
|
+
6. __*interfaces*__ - network interface hash cards specification. Each NIC is
|
424
|
+
hashed by its name (for instance, *eth0*, *eth1*, etc).
|
425
|
+
|
426
|
+
__IMPORTANT__: For Linux guests, the NIC name defined in a plan should
|
427
|
+
correspond to its logical name in the guest OS.
|
428
|
+
|
429
|
+
__NOTE__: NICs are ordered and configured within the the guest OS in the
|
430
|
+
order they were defined in the plan.
|
431
|
+
|
432
|
+
__IMPORTANT__: This property is required unless the provider type is
|
433
|
+
*baremetal*.
|
434
|
+
|
435
|
+
Following is a list of properties that descirbe a network interface card:
|
436
|
+
1. __*network*__ - name of the network the NIC belongs to. The network
|
437
|
+
must exist in infrastructures' networks hash.
|
438
|
+
|
439
|
+
__IMPORTANT:__ In case of OpenStack providers, the network name must
|
440
|
+
point to valid subnet rather than a network name.
|
441
|
+
|
442
|
+
2. __*ip*__ - a property that defines an IP address. Following values are
|
443
|
+
permitted:
|
444
|
+
- a properly formatted string witn an IP in case of static,
|
445
|
+
- a *dhcp* literal in case the IP should by assigned by DHCP,
|
446
|
+
- *none* literal in case no IP adress should be set for a given interface.
|
447
|
+
|
448
|
+
3. __*set_gateway*__ - an optional boolean property that defines, whether a
|
449
|
+
gateway should be defined for a given interface during guest customization.
|
450
|
+
It is `true` by default.
|
451
|
+
|
452
|
+
4. __*virtual_switch*__ - an optional (currently VSphere-specific) property
|
453
|
+
that specifies which distributed virtual switch should be used.
|
454
|
+
|
455
|
+
5. __*floating_network*__ - an optional OpenStack specific property that
|
456
|
+
specifies the network from which is the __floating__ IP provisioned and
|
457
|
+
associated with the interface.
|
458
|
+
|
459
|
+
7. __*disks*__ - an optional property to define additional disks that should
|
460
|
+
persist accross deployments. It is of hash type. The key represents a disk
|
461
|
+
name. A persistant disk itself is described by a so-called *"disk hash"*
|
462
|
+
with following keywords:
|
463
|
+
1. __*pool*__ - the name of the storage pool that should be used as a backing
|
464
|
+
store for a disk. It is required for OVirt/RHEVm and VSphere providers,
|
465
|
+
unless the __*default_pool*__ is specified in
|
466
|
+
__*infrastructure_properties*__.
|
467
|
+
2. __*size*__ - the size of the disk in megabytes (when the value has a
|
468
|
+
suffix *M*) or gigabytes (when the value has a suffix *G*).
|
469
|
+
3. __*thin*__ - an optional boolean flag that indicates whether the disk will be
|
470
|
+
thin provisioned. Its default value is *true*, meaning the disks are
|
471
|
+
thin-provisioned by default. Please use *false* as the value if you need to
|
472
|
+
thick provision a disk.
|
473
|
+
|
474
|
+
__IMPORTANT:__ Currently, the selection of provisioning type is honored
|
475
|
+
only by OVirt/RHEVm provider. A thick-provisioned disk in OVirt/RHEVm
|
476
|
+
provider is of __raw__ rather than __cow__ type. As a consequence,
|
477
|
+
it is not possible to create a snapshot of such a disk.*
|
478
|
+
|
479
|
+
8. __*credentials*__ - an optional property to define credentials for
|
480
|
+
administrator user (root, Administrator). This information is passed to
|
481
|
+
the customization tool (cloud-init, VSphere customization, etc.). Following
|
482
|
+
data can be specified:
|
483
|
+
* __*root_password*__ - super user password that is set for cloud init phase,
|
484
|
+
* __*root_ssh_keys*__ - an array of OpenSSH public keys that are recorded
|
485
|
+
into `/root/.ssh/authorized_keys` by cloud init.
|
486
|
+
* __*administrator_password*__ - an optional property that specifies the
|
487
|
+
password of the administrator user for VSphere-based windows-guests
|
488
|
+
customization. it defaults to an empty password which in turn leads to an
|
489
|
+
automatic logon upon windows guest startup.
|
490
|
+
|
491
|
+
9. __*flavor*__ - an optional property that specifies how to set the amount of
|
492
|
+
CPU cores, memory and the size of the *root* disk. Please consult
|
493
|
+
[OpenStack
|
494
|
+
flavors](http://docs.openstack.org/openstack-ops/content/flavors.html) for
|
495
|
+
their definition. In case the infrastructure does not support flavors feature,
|
496
|
+
it is emulated.
|
497
|
+
|
498
|
+
__IMPORTANT:__ The __flavor__ property is mutually exclusive with any of
|
499
|
+
__cores__, __memory__ or __storage__ properties. Having said that, an
|
500
|
+
exception will logged if __flavor__ is specified along with one or more
|
501
|
+
of __cores__, __memory__ and/or __storage__ properties.
|
502
|
+
|
503
|
+
10. __*cores*__ - an optional positive integer that sets the number of cores
|
504
|
+
for a given node. It is `2` by default.
|
505
|
+
|
506
|
+
11. __*memory*__ - an optional value that is used to set the amount of
|
507
|
+
provisioned memory for a given node. The default is `4G`.
|
508
|
+
|
509
|
+
The format of an input value is a positive number followed by one of:
|
510
|
+
* `K` for kibibytes,
|
511
|
+
* `M` for mebibytes,
|
512
|
+
* `G` for gibibytes,
|
513
|
+
* `KB` for kilobytes,
|
514
|
+
* `MB` for megabytes,
|
515
|
+
* `GB` for gigabytes.
|
516
|
+
|
517
|
+
12. __*storage*__ - an that specifies the size of the root volume. The
|
518
|
+
default value is `10G`.
|
519
|
+
|
520
|
+
Please note that some infrastructure providers disregard this value,
|
521
|
+
especially when the node is provisioned from a template.
|
522
|
+
|
523
|
+
Please have a look to __*memory*__ for formatting of input value.
|
524
|
+
|
525
|
+
|
526
|
+
13. __*timezone*__ - a property that specifies the timezone of the guest
|
527
|
+
operating system. Please make sure that:
|
528
|
+
* [following values are
|
529
|
+
used](https://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/New-OSCustomizationSpec.html)
|
530
|
+
for VSphere-based windows guests customization,
|
531
|
+
* for Linux guests, values specified in a __`TZ`__ column of the [list of
|
532
|
+
tz databaze time zones](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
533
|
+
are used.
|
534
|
+
|
535
|
+
__IMPORTANT:__ This property is required when customizing guest on *VSPhere* provider.
|
536
|
+
|
537
|
+
14. __*product_id*__ - an optional, VSphere-specific windows-only guest customization
|
538
|
+
property that specifies a serial number. Its default value is
|
539
|
+
undefined which leaves the guest OS in an evaluation/trial mode.
|
540
|
+
|
541
|
+
15. __*organization_name*__ - a required, VSphere-specific windows-only guest
|
542
|
+
customization property that specifies the organization name of the
|
543
|
+
administrator user.
|
544
|
+
|
545
|
+
16. __*dns*__ - an optional property that specifies name servers and search
|
546
|
+
domains for further node customization. If specified, it has to be a hash
|
547
|
+
with any of the following items:
|
548
|
+
1. __*name_servers*__ - a list of valid IP addresses.
|
549
|
+
2. __*search_domains*__ - a list of valid domains.
|
550
|
+
|
551
|
+
The example bellow shows a specification for a database backend and a web node:
|
552
|
+
```yaml
|
553
|
+
nodes:
|
554
|
+
mgt01.example.com:
|
555
|
+
infrastructure: management
|
556
|
+
infrastructure_properties:
|
557
|
+
affinity_groups:
|
558
|
+
- clu-lab1ch-ag_1
|
559
|
+
- clu-lab1ch-ag_3
|
560
|
+
keep_ha: false
|
561
|
+
datacenter: lab1ch
|
562
|
+
cluster: clu-lab1ch
|
563
|
+
default_pool: ssd_pool1
|
564
|
+
full_clone: false
|
565
|
+
image: rhel6cloudinit
|
566
|
+
interfaces:
|
567
|
+
eth0:
|
568
|
+
network: management
|
569
|
+
ip: dhcp
|
570
|
+
credentials:
|
571
|
+
- root_password
|
572
|
+
- root_ssh_pubkey
|
573
|
+
|
574
|
+
mssql01_mgt01:
|
575
|
+
fqdn: mssql01.example.com
|
576
|
+
infrastructure: management
|
577
|
+
infrastructure_properties:
|
578
|
+
datacenter: lab1ch
|
579
|
+
cluster: clu-lab1ch
|
580
|
+
keep_ha: true
|
581
|
+
image: win12r1_64
|
582
|
+
cores: 6
|
583
|
+
memory: 64G
|
584
|
+
storage: 128G
|
585
|
+
interfaces:
|
586
|
+
eth0:
|
587
|
+
network: management
|
588
|
+
ip: 192.168.254.13
|
589
|
+
disks:
|
590
|
+
db1:
|
591
|
+
pool: storage_pool3
|
592
|
+
size: 256G
|
593
|
+
thin: false
|
594
|
+
credentials:
|
595
|
+
- admin_password
|
596
|
+
|
597
|
+
mysql01.example.com:
|
598
|
+
infrastructure: lamp
|
599
|
+
infrastructure_properties:
|
600
|
+
tenant: lamp01
|
601
|
+
image: rhel6cloudinit
|
602
|
+
flavor: medium
|
603
|
+
interfaces:
|
604
|
+
eth0:
|
605
|
+
network: management-subnet
|
606
|
+
ip: 192.168.253.25
|
607
|
+
eth1:
|
608
|
+
network: production-subnet
|
609
|
+
ip: 192.168.2.102
|
610
|
+
floating_network: ext-net0
|
611
|
+
disks:
|
612
|
+
rdo:
|
613
|
+
pool: storage_pool1
|
614
|
+
size: 4000M
|
615
|
+
thin: false
|
616
|
+
db1:
|
617
|
+
size: 20G
|
618
|
+
|
619
|
+
mssql01.example.com:
|
620
|
+
infrastructure: db
|
621
|
+
infrastructure_properties:
|
622
|
+
dest_folder: sql
|
623
|
+
datacenter: dc01
|
624
|
+
cluster: cl01
|
625
|
+
default_pool: sql_pool
|
626
|
+
image: w12r2
|
627
|
+
flavor: medium
|
628
|
+
interfaces:
|
629
|
+
eth0:
|
630
|
+
network: management
|
631
|
+
ip: 192.168.252.33
|
632
|
+
set_gateway: false
|
633
|
+
eth1:
|
634
|
+
network: db
|
635
|
+
ip: 192.168.3.109
|
636
|
+
disks:
|
637
|
+
rdo:
|
638
|
+
pool: storage_pool3
|
639
|
+
size: 4000M
|
640
|
+
thin: false
|
641
|
+
db1:
|
642
|
+
size: 20G
|
643
|
+
credentials:
|
644
|
+
- admin_password
|
645
|
+
timezone: 100
|
646
|
+
organization_name: Acme
|
647
|
+
|
648
|
+
web01.example.com:
|
649
|
+
infrastructure: lamp
|
650
|
+
infrastructure_properties:
|
651
|
+
tenant: lamp01
|
652
|
+
datacenter: lab1ch
|
653
|
+
cluster: clu-lab1ch
|
654
|
+
image: rhel6
|
655
|
+
flavor: small
|
656
|
+
interfaces:
|
657
|
+
eth0:
|
658
|
+
network: management-subnet
|
659
|
+
ip: 192.168.253.26
|
660
|
+
eth1:
|
661
|
+
network: production-subnet
|
662
|
+
ip: dhcp
|
663
|
+
floating_network: ext-net0
|
664
|
+
```
|
665
|
+
|
666
|
+
|
667
|
+
## Configuration
|
668
|
+
|
669
|
+
The configurations hash contains hashes with settings for nodes and roles
|
670
|
+
|
671
|
+
### Nodes
|
672
|
+
|
673
|
+
the nodes configuration hash assigns variables to an individual node or to a selected set of nodes. Here are some examples:
|
674
|
+
|
675
|
+
```yaml
|
676
|
+
configuration:
|
677
|
+
nodes:
|
678
|
+
mysql01.example.com:
|
679
|
+
role: mysql
|
680
|
+
my_var: my_value
|
681
|
+
web04.example.com:
|
682
|
+
role: httpd_special
|
683
|
+
```
|
684
|
+
|
685
|
+
The only relevant setting here for DOP is the role variable. The name of the role variable can be configured but defaults to 'role'. If hiera is configured and activated, then dop_common will take the role specified in hiera if found. The hierarchy for the role resolution is as follows:
|
686
|
+
|
687
|
+
1. Hiera
|
688
|
+
2. fqdn match in nodes configuration in Plan file
|
689
|
+
4. Default
|
690
|
+
|
691
|
+
A node always needs a role. If the parser finds no value for one of the specified nodes in the plan file and if no default is set, the dop_common will throw an error.
|
692
|
+
|
693
|
+
### Roles
|
694
|
+
|
695
|
+
You can set variables for a specific role in this hash.
|
696
|
+
|
697
|
+
```yaml
|
698
|
+
configuration:
|
699
|
+
roles:
|
700
|
+
mysql:
|
701
|
+
mysql::default_database:
|
702
|
+
name: mydatabase
|
703
|
+
user: myuser
|
704
|
+
password: mypass
|
705
|
+
```
|
706
|
+
|
707
|
+
This is only used from puppet over the hiera plugin and not from DOP itself at the moment.
|
708
|
+
|
709
|
+
## Steps and step sets
|
710
|
+
|
711
|
+
The steps array is a list of commands that have to be executed in the correct order. Each element in the array contains a hash of settings which describe the step, the nodes involved and the command to execute.
|
712
|
+
|
713
|
+
Example:
|
714
|
+
```yaml
|
715
|
+
steps:
|
716
|
+
- name: run_puppet_on_mysql
|
717
|
+
nodes:
|
718
|
+
- mysql01.example.com
|
719
|
+
command: ssh_run_puppet
|
720
|
+
|
721
|
+
- name: run_puppet_on_webserver
|
722
|
+
roles:
|
723
|
+
- httpd_basic
|
724
|
+
- https_special
|
725
|
+
command: ssh_run_puppet
|
726
|
+
|
727
|
+
- name: reboot_all_nodes
|
728
|
+
nodes: all
|
729
|
+
command: ssh_reboot
|
730
|
+
|
731
|
+
- name: run_puppet_in_noop_on_proxies
|
732
|
+
roles:
|
733
|
+
- haproxy
|
734
|
+
command:
|
735
|
+
plugin: ssh_puppet_run
|
736
|
+
arguments:
|
737
|
+
'--noop':
|
738
|
+
```
|
739
|
+
|
740
|
+
You can define multiple sets of steps which can be executed independently of each other.
|
741
|
+
|
742
|
+
Example:
|
743
|
+
```yaml
|
744
|
+
steps:
|
745
|
+
'default':
|
746
|
+
- name: run_puppet_on_mysql
|
747
|
+
nodes:
|
748
|
+
- mysql01.example.com
|
749
|
+
command: ssh_run_puppet
|
750
|
+
|
751
|
+
- name: run_puppet_on_webserver
|
752
|
+
roles:
|
753
|
+
- httpd_basic
|
754
|
+
- https_special
|
755
|
+
command: ssh_run_puppet
|
756
|
+
|
757
|
+
'maintenance':
|
758
|
+
- name: reboot_all_nodes
|
759
|
+
nodes: all
|
760
|
+
command: ssh_reboot
|
761
|
+
|
762
|
+
- name: run_puppet_in_noop_on_proxies
|
763
|
+
roles:
|
764
|
+
- haproxy
|
765
|
+
command:
|
766
|
+
plugin: ssh_puppet_run
|
767
|
+
arguments:
|
768
|
+
'--noop':
|
769
|
+
```
|
770
|
+
|
771
|
+
The run command will always execute the 'default' step set if nothing else is specified. If only one set is
|
772
|
+
specified in the array form without a name this set will have the name 'default'.
|
773
|
+
|
774
|
+
### name
|
775
|
+
|
776
|
+
The name is just an identifier for the step. You should chose a name that best describes what you are doing in this step.
|
777
|
+
|
778
|
+
### nodes
|
779
|
+
|
780
|
+
This can either be one or a list of nodes and/or Regex patterns or the keyword "all" which will include all nodes for the step.
|
781
|
+
|
782
|
+
If an entry starts and ends with a '/' DOPi will interpret the string as a regular expression.
|
783
|
+
|
784
|
+
### set_plugin_defaults
|
785
|
+
|
786
|
+
(This will be in DOPi >= 0.4)
|
787
|
+
|
788
|
+
With "set_plugin_defaults" it is possible to specify some default values for plugin configuration which will persist over subsequent runs.
|
789
|
+
|
790
|
+
The settings are node specific, so they will only be set for the nodes in your step. You can select the plugins for which this applies with
|
791
|
+
a list or with regular expressions.
|
792
|
+
|
793
|
+
Direct settings in the plugins will always overwrite the defaults.
|
794
|
+
|
795
|
+
IMPORTANT: The keys you want to set have to be ruby symbols. This is a current limitation of the way the parser is implemented and may change in the future
|
796
|
+
|
797
|
+
Example:
|
798
|
+
```yaml
|
799
|
+
|
800
|
+
steps:
|
801
|
+
- name: "Set default passwords for Plugins"
|
802
|
+
nodes: all
|
803
|
+
set_plugin_defaults:
|
804
|
+
- plugins: '/^ssh/'
|
805
|
+
:credentials: 'linux_staging_password'
|
806
|
+
- plugins: '/^winrm/'
|
807
|
+
:credentials: 'windows_staging_password'
|
808
|
+
- plugins:
|
809
|
+
- 'ssh/custom'
|
810
|
+
:quiet: false
|
811
|
+
|
812
|
+
```
|
813
|
+
|
814
|
+
### delete_plugin_defaults
|
815
|
+
|
816
|
+
(This will be in DOPi >= 0.4)
|
817
|
+
|
818
|
+
There are several possibilities how you can remove plugin settings with "delete_plugin_defaults"
|
819
|
+
|
820
|
+
IMPORTANT: The keys you want to set have to be ruby symbols. This is a current limitation of the way the parser is implemented and may change in the future
|
821
|
+
|
822
|
+
Example:
|
823
|
+
```yaml
|
824
|
+
- name: "Remove some specific defaults for all nodes"
|
825
|
+
nodes: all
|
826
|
+
delete_plugin_defaults:
|
827
|
+
- plugins: '/^ssh/'
|
828
|
+
delete_keys:
|
829
|
+
- :credentials
|
830
|
+
- :timeout
|
831
|
+
|
832
|
+
- name: "Remove all the defaults for the ssh plugins for all nodes in role 'foo'"
|
833
|
+
roles:
|
834
|
+
- foo
|
835
|
+
delete_plugin_defaults:
|
836
|
+
- plugins: '/^ssh/'
|
837
|
+
delete_keys: all
|
838
|
+
|
839
|
+
- name: "Remove all the defaults for all plugins for all nodes"
|
840
|
+
nodes: all
|
841
|
+
delete_plugin_defaults: all
|
842
|
+
|
843
|
+
```
|
844
|
+
|
845
|
+
### nodes_by_config
|
846
|
+
|
847
|
+
Include nodes to a step by specific configuration values which are resolved over hiera.
|
848
|
+
|
849
|
+
Example:
|
850
|
+
```yaml
|
851
|
+
|
852
|
+
configuration:
|
853
|
+
nodes:
|
854
|
+
'mysql01.example.com':
|
855
|
+
'my_alias': 'database_01'
|
856
|
+
|
857
|
+
steps:
|
858
|
+
- name: 'include by config'
|
859
|
+
nodes_by_config:
|
860
|
+
'my_alias': 'database_01'
|
861
|
+
command: ssh_run_puppet
|
862
|
+
|
863
|
+
```
|
864
|
+
|
865
|
+
If the value of the config variable is an array it will check each value in that array. You can also use pattern here like with node
|
866
|
+
|
867
|
+
Example:
|
868
|
+
```yaml
|
869
|
+
|
870
|
+
configuration:
|
871
|
+
nodes:
|
872
|
+
'mysql01.example.com':
|
873
|
+
'my_alias':
|
874
|
+
- 'database_01'
|
875
|
+
- 'some_other_alias'
|
876
|
+
|
877
|
+
steps:
|
878
|
+
- name: 'include by config'
|
879
|
+
nodes_by_config:
|
880
|
+
my_alias:
|
881
|
+
- '/^linux/'
|
882
|
+
- 'database_01'
|
883
|
+
command: ssh_run_puppet
|
884
|
+
|
885
|
+
```
|
886
|
+
|
887
|
+
### roles
|
888
|
+
|
889
|
+
This will include all the nodes with a certain role to a step.
|
890
|
+
|
891
|
+
roles and nodes can be mixed, dop_common will simply merge the list of nodes. However there has to be at least one node in every step.
|
892
|
+
|
893
|
+
If an entry starts and ends with a '/' DOPi will interpret the string as a regular expression.
|
894
|
+
|
895
|
+
roles is basically just a special case for nodes_by_config with the roles variable. But it will do some additional checks and you can also set
|
896
|
+
a default value for the role on DOPi.
|
897
|
+
|
898
|
+
### exclude_nodes
|
899
|
+
|
900
|
+
A list of nodes to exclude from the list that gets assembled from nodes and roles. This can also contain Regex patterns like nodes and roles.
|
901
|
+
|
902
|
+
### exclude_nodes_by_config
|
903
|
+
|
904
|
+
Exclude nodes based on config values and matching patterns.
|
905
|
+
|
906
|
+
### exclude_roles
|
907
|
+
|
908
|
+
Works exactly like exclude_nodes but excludes roles.
|
909
|
+
|
910
|
+
### commands
|
911
|
+
|
912
|
+
The commands can either be directly a plugin name if a simgle plugin and no parameters, a single command hash which will be passed to the plugin or an array of command hashes if multiple commands have to be executed in a single step. The only fixed variable here is the **plugin** variable. The rest of the variables in the command hash depends on the plugin in use and how it will parse the hash.
|
913
|
+
|
914
|
+
For more documentation about the plugins and the variables available for configuring them, check the DOPi documentation.
|
915
|
+
|
916
|
+
# Examples
|
917
|
+
|
918
|
+
For a complete example plan file see:
|
919
|
+
[DOP Plan Format v 0.0.1 Example](examples/example_deploment_plan_v0.0.1.yaml)
|