dop_common 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +176 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE.txt +177 -0
  8. data/README.md +48 -0
  9. data/Rakefile +49 -0
  10. data/Vagrantfile +25 -0
  11. data/bin/dop-puppet-autosign +56 -0
  12. data/doc/examples/example_deploment_plan_v0.0.1.yaml +302 -0
  13. data/doc/plan_format_v0.0.1.md +919 -0
  14. data/doc/plan_format_v0.0.2_snippets.md +56 -0
  15. data/dop_common.gemspec +44 -0
  16. data/lib/dop_common/affinity_group.rb +57 -0
  17. data/lib/dop_common/cli/global_options.rb +37 -0
  18. data/lib/dop_common/cli/log.rb +51 -0
  19. data/lib/dop_common/cli/node_selection.rb +62 -0
  20. data/lib/dop_common/command.rb +125 -0
  21. data/lib/dop_common/config/helper.rb +39 -0
  22. data/lib/dop_common/config.rb +66 -0
  23. data/lib/dop_common/configuration.rb +37 -0
  24. data/lib/dop_common/credential.rb +152 -0
  25. data/lib/dop_common/data_disk.rb +62 -0
  26. data/lib/dop_common/dns.rb +55 -0
  27. data/lib/dop_common/hash_parser.rb +241 -0
  28. data/lib/dop_common/hooks.rb +81 -0
  29. data/lib/dop_common/infrastructure.rb +160 -0
  30. data/lib/dop_common/infrastructure_properties.rb +185 -0
  31. data/lib/dop_common/interface.rb +113 -0
  32. data/lib/dop_common/log.rb +78 -0
  33. data/lib/dop_common/network.rb +85 -0
  34. data/lib/dop_common/node/config.rb +159 -0
  35. data/lib/dop_common/node.rb +442 -0
  36. data/lib/dop_common/node_filter.rb +74 -0
  37. data/lib/dop_common/plan.rb +188 -0
  38. data/lib/dop_common/plan_cache.rb +83 -0
  39. data/lib/dop_common/plan_store.rb +263 -0
  40. data/lib/dop_common/pre_processor.rb +73 -0
  41. data/lib/dop_common/run_options.rb +56 -0
  42. data/lib/dop_common/signal_handler.rb +58 -0
  43. data/lib/dop_common/state_store.rb +95 -0
  44. data/lib/dop_common/step.rb +200 -0
  45. data/lib/dop_common/step_set.rb +41 -0
  46. data/lib/dop_common/thread_context_logger.rb +77 -0
  47. data/lib/dop_common/utils.rb +106 -0
  48. data/lib/dop_common/validator.rb +53 -0
  49. data/lib/dop_common/version.rb +3 -0
  50. data/lib/dop_common.rb +32 -0
  51. data/lib/hiera/backend/dop_backend.rb +94 -0
  52. data/lib/hiera/dop_logger.rb +20 -0
  53. data/spec/data/fake_hook_file_invalid +1 -0
  54. data/spec/data/fake_hook_file_valid +5 -0
  55. data/spec/data/fake_keyfile +1 -0
  56. data/spec/dop-puppet-autosign_spec_disable.rb +33 -0
  57. data/spec/dop_common/affinity_group_spec.rb +41 -0
  58. data/spec/dop_common/command_spec.rb +83 -0
  59. data/spec/dop_common/credential_spec.rb +73 -0
  60. data/spec/dop_common/data_disk_spec.rb +165 -0
  61. data/spec/dop_common/dns_spec.rb +33 -0
  62. data/spec/dop_common/hash_parser_spec.rb +181 -0
  63. data/spec/dop_common/hooks_spec.rb +33 -0
  64. data/spec/dop_common/infrastructure_properties_spec.rb +224 -0
  65. data/spec/dop_common/infrastructure_spec.rb +77 -0
  66. data/spec/dop_common/interface_spec.rb +192 -0
  67. data/spec/dop_common/network_spec.rb +92 -0
  68. data/spec/dop_common/node_filter_spec.rb +70 -0
  69. data/spec/dop_common/node_spec.rb +623 -0
  70. data/spec/dop_common/plan_cache_spec.rb +46 -0
  71. data/spec/dop_common/plan_spec.rb +136 -0
  72. data/spec/dop_common/plan_store_spec.rb +194 -0
  73. data/spec/dop_common/pre_processor_spec.rb +27 -0
  74. data/spec/dop_common/run_options_spec.rb +65 -0
  75. data/spec/dop_common/signal_handler_spec.rb +31 -0
  76. data/spec/dop_common/step_set_spec.rb +21 -0
  77. data/spec/dop_common/step_spec.rb +175 -0
  78. data/spec/dop_common/utils_spec.rb +27 -0
  79. data/spec/dop_common/validator_spec.rb +47 -0
  80. data/spec/example_plans_spec.rb +16 -0
  81. data/spec/fixtures/example_ssh_key +27 -0
  82. data/spec/fixtures/example_ssh_key.pub +1 -0
  83. data/spec/fixtures/incl/root_part.yaml +1 -0
  84. data/spec/fixtures/incl/some_list.yaml +2 -0
  85. data/spec/fixtures/other_plan_same_nodes.yaml +19 -0
  86. data/spec/fixtures/simple_include.yaml +6 -0
  87. data/spec/fixtures/simple_include_with_errors.yaml +4 -0
  88. data/spec/fixtures/simple_plan.yaml +19 -0
  89. data/spec/fixtures/simple_plan_invalid.yaml +18 -0
  90. data/spec/fixtures/simple_plan_modified.yaml +21 -0
  91. data/spec/spec_helper.rb +106 -0
  92. metadata +381 -0
@@ -0,0 +1,302 @@
1
+ name: 'example'
2
+ max_in_flight: 2
3
+
4
+ credentials:
5
+ 'linux_login':
6
+ type: 'username_password'
7
+ username: 'root'
8
+ password: 'mypass'
9
+ 'linux_root_ssh_pubkey':
10
+ type: 'ssh_key'
11
+ username: 'root'
12
+ public_key: 'AAAAdwejdi138124901809efjklfjlksjlj232390489023840sjdfdjql'
13
+ 'windows_login':
14
+ type: 'username_password'
15
+ username: 'Administrator'
16
+ password: 'mypass'
17
+ 'api_login':
18
+ type: 'username_password'
19
+ username: 'root'
20
+ password: 'mypass'
21
+
22
+ hooks:
23
+ pre_create_vm:
24
+ - spec/data/fake_hook_file_valid
25
+ post_create_vm:
26
+ - spec/data/fake_hook_file_valid
27
+ pre_update_vm:
28
+ - spec/data/fake_hook_file_valid
29
+ post_update_vm:
30
+ - spec/data/fake_hook_file_valid
31
+ pre_destroy_vm:
32
+ - spec/data/fake_hook_file_valid
33
+ post_destroy_vm:
34
+ - spec/data/fake_hook_file_valid
35
+
36
+ infrastructures:
37
+ baremetal:
38
+ type: baremetal
39
+
40
+ management:
41
+ type: rhev
42
+ endpoint: https://rhev.example.com/api
43
+ credentials: api_login
44
+ networks:
45
+ rhevm:
46
+ ip_pool:
47
+ from: 192.168.254.11
48
+ to: 192.168.254.245
49
+ ip_netmask: 255.255.255.0
50
+ ip_defgw: 192.168.254.254
51
+ production:
52
+ ip_pool:
53
+ from: 192.168.254.11
54
+ to: 192.168.254.245
55
+ ip_netmask: 255.255.255.0
56
+ ip_defgw: 192.168.254.254
57
+ sync:
58
+ ip_pool:
59
+ from: 192.168.253.1
60
+ to: 192.168.253.2
61
+ ip_netmask: 255.255.255.252
62
+ ip_defgw: false
63
+ affinity_groups:
64
+ clu-lab1ch-ag_1:
65
+ positive: true
66
+ enforce: true
67
+ cluster: clu-lab1ch
68
+ clu-lab1ch-ag_2:
69
+ positive: true
70
+ enforce: false
71
+ cluster: clu-lab1ch
72
+ clu-lab1ch-ag_3:
73
+ positive: false
74
+ enforce: true
75
+ cluster: clu-lab1ch
76
+ lamp:
77
+ type: rhos
78
+ endpoint: https://openstack.example.com/api
79
+ credentials: api_login
80
+ networks:
81
+ management:
82
+ ip_pool:
83
+ from: 192.168.253.11
84
+ to: 192.168.253.245
85
+ ip_netmask: 255.255.255.0
86
+ ip_defgw: 192.168.253.254
87
+ production:
88
+ ip_pool:
89
+ from: 192.168.1.101
90
+ to: 192.168.1.245
91
+ ip_netmask: 255.255.255.0
92
+ ip_defgw: 192.168.1.254
93
+
94
+ nodes:
95
+ mgt01.example.com:
96
+ infrastructure: management
97
+ infrastructure_properties:
98
+ affinity_groups:
99
+ - clu-lab1ch-ag_1
100
+ - clu-lab1ch-ag_3
101
+ keep_ha: true
102
+ datacenter: lab1ch
103
+ cluster: clu-lab1ch
104
+ image: rhel6cloudinit
105
+ interfaces:
106
+ eth0:
107
+ network: rhevm
108
+ ip: 192.168.254.12
109
+ credentials:
110
+ - linux_login
111
+ - linux_root_ssh_pubkey
112
+
113
+ mssql01_mgt01:
114
+ fqdn: mssql01.example.com
115
+ infrastructure: management
116
+ infrastructure_properties:
117
+ keep_ha: false
118
+ datacenter: lab1ch
119
+ cluster: clu-lab1ch
120
+ default_pool: ssd_pool
121
+ image: win12r1_64
122
+ cores: 6
123
+ memory: 64G
124
+ storage: 128G
125
+ interfaces:
126
+ eth0:
127
+ network: rhevm
128
+ ip: 192.168.254.13
129
+ disks:
130
+ db1:
131
+ pool: storage_pool3
132
+ size: 256G
133
+ log1:
134
+ size: 1024M
135
+ thin: false
136
+ credentials: windows_login
137
+
138
+ mysql01.example.com:
139
+ infrastructure: lamp
140
+ infrastructure_properties:
141
+ tenant: lamp
142
+ endpoint_type: adminURL
143
+ domain_id: lamp
144
+ image: rhel6cloudinit
145
+ flavor: m1.medium
146
+ interfaces:
147
+ eth0:
148
+ network: management
149
+ ip: 192.168.253.25
150
+ eth1:
151
+ network: production
152
+ ip: 192.168.1.102
153
+ set_gateway: false
154
+ disks:
155
+ rdo:
156
+ pool: storage_pool1
157
+ size: 4000M
158
+ thin: false
159
+ db1:
160
+ size: 20G
161
+ credentials:
162
+ - linux_login
163
+ dns:
164
+ name_servers:
165
+ - 10.0.3.3
166
+ search_domains:
167
+ - example.com
168
+
169
+ web01.example.com:
170
+ infrastructure: lamp
171
+ infrastructure_properties:
172
+ tenant: lamp
173
+ image: rhel6
174
+ flavor: small
175
+ interfaces:
176
+ eth0:
177
+ network: management
178
+ ip: 192.168.253.26
179
+ eth1:
180
+ network: production
181
+ ip: dhcp
182
+ dns:
183
+ name_servers:
184
+ - 10.0.3.3
185
+ - 172.16.0.1
186
+ search_domains:
187
+ - example.com
188
+ - ext.example.com
189
+
190
+ web02.example.com:
191
+ infrastructure: lamp
192
+ infrastructure_properties:
193
+ tenant: lamp
194
+ image: rhel6
195
+ flavor: medium
196
+ interfaces:
197
+ eth0:
198
+ network: management
199
+ ip: 192.168.253.27
200
+ eth1:
201
+ network: production
202
+ ip: 192.168.1.103
203
+ set_gateway: false
204
+
205
+ haproxy01.example.com:
206
+ infrastructure: lamp
207
+ infrastructure_properties:
208
+ tenant: lamp
209
+ default_pool: sas_pool
210
+ image: rhel6cloudinit
211
+ flavor: small
212
+ interfaces:
213
+ eth0:
214
+ network: management
215
+ ip: 192.168.253.28
216
+ eth1:
217
+ network: production
218
+ ip: dhcp
219
+ disks:
220
+ logs:
221
+ size: 265G
222
+ thin: false
223
+
224
+ storage01.example.com:
225
+ infrastructure: baremetal
226
+
227
+ configuration:
228
+ hosts:
229
+ mysql01.example.com:
230
+ my_role: mysql
231
+ web01.example.com:
232
+ my_role: httpd_basic
233
+ web02.example.com:
234
+ my_role: httpd_special
235
+ ssh_root_pass: mypass
236
+ haproxy01.example.com:
237
+ my_role: haproxy
238
+ roles:
239
+ mysql:
240
+ ssh_root_pass: mypass
241
+ mysql::default_database:
242
+ name: mydatabase
243
+ user: myuser
244
+ password: mypass
245
+
246
+ steps:
247
+ - name: 'Configure credentials for SSH plugins'
248
+ nodes: 'all'
249
+ set_plugin_defaults:
250
+ - plugins: '/^ssh/'
251
+ credentials: 'linux_login'
252
+ command: 'dummy'
253
+
254
+ - name: 'Make sure we can login to all nodes'
255
+ nodes: all
256
+ command:
257
+ plugin: ssh/wait_for_login
258
+ plugin_timeout: 600
259
+
260
+ - name: 'Install Puppet'
261
+ nodes: all
262
+ command:
263
+ plugin: ssh/custom
264
+ verify_commands:
265
+ - plugin: ssh/file_exists
266
+ file: /usr/bin/puppet
267
+ exec: yum
268
+ arguments: 'install puppet'
269
+ expect_exit_codes: 0
270
+ fail_on_warning: False
271
+ parse_output:
272
+ error:
273
+ - '^No package puppet available'
274
+
275
+ - name: 'Initial Puppet run to configure puppet'
276
+ nodes: all
277
+ command:
278
+ plugin: ssh/puppet_agent_run
279
+ verify_commands:
280
+ - plugin: ssh/file_contains
281
+ file: /etc/puppet/puppet.conf
282
+ pattern: puppet.example.com
283
+ arguments:
284
+ - '--server puppet.example.com'
285
+ - '--environment production'
286
+ - '--tags puppet::client'
287
+
288
+ - name: 'Configure the MySQL server'
289
+ nodes:
290
+ - mysql01.example.com
291
+ command: ssh/puppet_agent_run
292
+
293
+ - name: 'Configure the Webservers'
294
+ roles:
295
+ - httpd_basic
296
+ - httpd_special
297
+ command: ssh/puppet_agent_run
298
+
299
+ - name: 'Configure the HA Proxy'
300
+ roles:
301
+ - haproxy
302
+ command: ssh/puppet_agent_run