|
1 # = Define puppi::project::y4maven |
|
2 # |
|
3 # This is a shortcut define to build a puppi project for the |
|
4 # deploying hybris-production-zips via Maven and published on |
|
5 # a repository like artifactory. |
|
6 # |
|
7 # It uses different "core" defines (puppi::project, puppi:deploy (many), |
|
8 # puppi::rollback (many)) to build a full featured template project for |
|
9 # automatic deployments. |
|
10 # If you need to customize it, either change the template defined here or |
|
11 # build up your own custom ones. |
|
12 # |
|
13 # == Variables: |
|
14 # |
|
15 # [*source*] |
|
16 # The full URL of the maven-metadata.xml file to retrieve. |
|
17 # Format should be in URI standard (http:// file:// ssh:// rsync://). |
|
18 # |
|
19 # [*http_password*] |
|
20 # The http_password to use for authentication to the source in case of http. |
|
21 # |
|
22 # [*http_user*] |
|
23 # The http_user to use for authentication to the source in case of http. |
|
24 # |
|
25 # [*artifact_type*] |
|
26 # The artifact_type to parse the maven-metadata.xml. Either "release" or "latest" |
|
27 # Default is "release". With artifactory, don't use the |
|
28 # "Maven Snapshot Version Behavior" "unique" for your repository. |
|
29 # |
|
30 # [*deploy_root*] |
|
31 # The destination directory where file(s) are deployed. |
|
32 # |
|
33 # [*user*] |
|
34 # (Optional) - The user to be used for deploy operations. |
|
35 # |
|
36 # [*war_suffix*] |
|
37 # (Optional) - The suffix (Maven qualifier) that might be appended to the war |
|
38 # |
|
39 # [*zip_suffix*] |
|
40 # (Optional) - The suffix (Maven qualifier) that might be appended to the zip |
|
41 # |
|
42 # [*jar_root*] |
|
43 # (Optional) - The destination directory where the jar is copied. |
|
44 # If set a jar file is searched in Maven |
|
45 # |
|
46 # [*jar_user*] |
|
47 # (Optional) - The user to be used for deploy operations of the jar |
|
48 # (owner of the files deployed in $jar_root) |
|
49 # |
|
50 # [*jar_suffix*] |
|
51 # (Optional) - The suffix (Maven qualifier) that might be appended to the jar |
|
52 # |
|
53 # [*document_root*] |
|
54 # (Optional) - The destination directory where the eventual tarball generated |
|
55 # via Maven containing static files ("src tar") is unpacked |
|
56 # |
|
57 # [*document_suffix*] |
|
58 # (Optional) - The suffix (Maven qualifier) that might be appended to the |
|
59 # static files tarballs ("src tar") |
|
60 # |
|
61 # [*document_init_source*] |
|
62 # (Optional) - The full URL to be used to retrieve, for the first time, the |
|
63 # project files present in the source tarball. They are copied to the |
|
64 # $document_root. Format should be in URI standard (http:// file:// ...) |
|
65 # |
|
66 # [*document_user*] |
|
67 # (Optional) - The user to be used for deploy operations of the tarball |
|
68 # (owner of the files in $document_root) |
|
69 # |
|
70 # [*config_root*] |
|
71 # (Optional) - The destination directory where the cfg tar is unpacked |
|
72 # |
|
73 # [*config_suffix*] |
|
74 # (Optional) - The suffix (Maven qualifier) that might be appended to |
|
75 # configuration tarballs ("cfg tar") |
|
76 # |
|
77 # [*config_init_source*] |
|
78 # (Optional) - The full URL to be used to retrieve, for the first time, the |
|
79 # project files present in the cfg tar. They are copied to the $config_root. |
|
80 # Format should be in URI standard (http:// file:// ssh:// svn://) |
|
81 # |
|
82 # [*config_user*] |
|
83 # (Optional) - The user to be used for deploy operations of cfg tar |
|
84 # (owner of the files in $config_root) |
|
85 # |
|
86 # [*predeploy_customcommand*] |
|
87 # (Optional) - Full path with arguments of an eventual custom command to |
|
88 # execute before the deploy. The command is executed as $predeploy_user. |
|
89 # |
|
90 # [*predeploy_user*] |
|
91 # (Optional) - The user to be used to execute the $predeploy_customcommand. |
|
92 # By default is the same of $user. |
|
93 # |
|
94 # [*predeploy_priority*] |
|
95 # (Optional) - The priority (execution sequence number) that defines when, |
|
96 # during the deploy procedure, the $predeploy_customcommand is executed |
|
97 # Default: 39 (immediately before the copy of files on the deploy root). |
|
98 # |
|
99 # [*postdeploy_customcommand*] |
|
100 # (Optional) - Full path with arguments of an eventual custom command to |
|
101 # execute after the deploy. The command is executed as $postdeploy_user. |
|
102 # |
|
103 # [*postdeploy_user*] |
|
104 # (Optional) - The user to be used to execute the $postdeploy_customcommand. |
|
105 # By default is the same of $user. |
|
106 # |
|
107 # [*postdeploy_priority*] |
|
108 # (Optional) - The priority (execution sequence number) that defines when, |
|
109 # during the deploy procedure, the $postdeploy_customcommand is executed |
|
110 # Default: 41 (immediately after the copy of files on the deploy root). |
|
111 # |
|
112 # [*init_script*] |
|
113 # (Optional - Obsolete) - The name (ex: tomcat) of the init script of your |
|
114 # Application server. If you define it, the AS is stopped and then started |
|
115 # during deploy. This option is deprecated, you can use $disable_services |
|
116 # for the same functionality |
|
117 # |
|
118 # [*disable_services*] |
|
119 # (Optional) - The names (space separated) of the services you might want to |
|
120 # stop during deploy. By default is blank. Example: "apache puppet monit". |
|
121 # |
|
122 # [*firewall_src_ip*] |
|
123 # (Optional) - The IP address of a loadbalancer you might want to block out |
|
124 # during a deploy. |
|
125 # |
|
126 # [*firewall_dst_port*] |
|
127 # (Optional) - The local port to block from the loadbalancer during deploy |
|
128 # (Default all). |
|
129 # |
|
130 # [*firewall_delay*] |
|
131 # (Optional) - A delay time in seconds to wait after the block of |
|
132 # $firewall_src_ip. Should be at least as long as the loadbalancer check |
|
133 # interval for the services stopped during deploy (Default: 1). |
|
134 # |
|
135 # [*report_email*] |
|
136 # (Optional) - The (space separated) email(s) to notify of deploy/rollback |
|
137 # operations. If none is specified, no email is sent. |
|
138 # |
|
139 # [*backup_rsync_options*] |
|
140 # (Optional) - The extra options to pass to rsync for backup operations. Use |
|
141 # it, for example, to exclude directories that you don't want to archive. |
|
142 # IE: "--exclude .snapshot --exclude cache --exclude www/cache". |
|
143 # |
|
144 # [*backup_retention*] |
|
145 # (Optional) - Number of backup archives to keep. (Default 5). |
|
146 # Lower the default value if your backups are too large and may fill up the |
|
147 # filesystem. |
|
148 # |
|
149 # [*run_checks*] |
|
150 # (Optional) - If you want to run local puppi checks before and after the |
|
151 # deploy procedure. Default: "true". |
|
152 # |
|
153 # [*always_deploy*] |
|
154 # (Optional) - If you always deploy what has been downloaded. Default="yes", |
|
155 # if set to "no" a checksum is made between the files previously downloaded |
|
156 # and the new files. If they are the same the deploy is not done. |
|
157 # |
|
158 # [*check_deploy*] |
|
159 # (Optional) - Checks if the war is deployed (Default yes). Set to no if |
|
160 # you deploy on Jboss or the deployed dir is different for the war filename |
|
161 # |
|
162 # [*auto_deploy*] |
|
163 # (Optional) - If you want to automatically run this puppi deploy when |
|
164 # Puppet runs. Default: 'false' |
|
165 # |
|
166 define puppi::project::y4maven ( |
|
167 $source, |
|
168 $http_user = '', |
|
169 $http_password = '', |
|
170 $artifact_type = 'release', |
|
171 $deploy_root = '', |
|
172 $user = 'root', |
|
173 $war_suffix = 'suffixnotset', |
|
174 $zip_suffix = 'suffixnotset', |
|
175 $jar_root = '', |
|
176 $jar_user = '', |
|
177 $jar_suffix = 'suffixnotset', |
|
178 $document_root = '', |
|
179 $document_user = '', |
|
180 $document_suffix = 'suffixnotset', |
|
181 $document_init_source = '', |
|
182 $config_root = '', |
|
183 $config_user = '', |
|
184 $config_suffix = 'suffixnotset', |
|
185 $config_init_source = '', |
|
186 $predeploy_customcommand = '', |
|
187 $predeploy_user = '', |
|
188 $predeploy_priority = '39', |
|
189 $postdeploy_customcommand = '', |
|
190 $postdeploy_user = '', |
|
191 $postdeploy_priority = '41', |
|
192 $init_script = '', |
|
193 $disable_services = '', |
|
194 $firewall_src_ip = '', |
|
195 $firewall_dst_port = '0', |
|
196 $firewall_delay = '1', |
|
197 $report_email = '', |
|
198 $backup_rsync_options = '--exclude .snapshot', |
|
199 $backup_retention = '5', |
|
200 $run_checks = true, |
|
201 $always_deploy = true, |
|
202 $check_deploy = true, |
|
203 $auto_deploy = false, |
|
204 $enable = true ) { |
|
205 |
|
206 require puppi |
|
207 require puppi::params |
|
208 |
|
209 # Set default values |
|
210 $predeploy_real_user = $predeploy_user ? { |
|
211 '' => $user, |
|
212 default => $predeploy_user, |
|
213 } |
|
214 |
|
215 $postdeploy_real_user = $postdeploy_user ? { |
|
216 '' => $user, |
|
217 default => $postdeploy_user, |
|
218 } |
|
219 |
|
220 $config_real_user = $config_user ? { |
|
221 '' => $user, |
|
222 default => $config_user, |
|
223 } |
|
224 |
|
225 $document_real_user = $document_user ? { |
|
226 '' => $user, |
|
227 default => $document_user, |
|
228 } |
|
229 |
|
230 $jar_real_user = $jar_user ? { |
|
231 '' => $user, |
|
232 default => $jar_user, |
|
233 } |
|
234 |
|
235 $real_always_deploy = any2bool($always_deploy) ? { |
|
236 false => 'no', |
|
237 true => 'yes', |
|
238 } |
|
239 |
|
240 $bool_run_checks = any2bool($run_checks) |
|
241 $bool_check_deploy = any2bool($check_deploy) |
|
242 $bool_auto_deploy = any2bool($auto_deploy) |
|
243 |
|
244 |
|
245 ### CREATE PROJECT |
|
246 puppi::project { $name: |
|
247 enable => $enable , |
|
248 } |
|
249 |
|
250 |
|
251 ### INIT SEQUENCE |
|
252 if ($document_init_source != '') { |
|
253 puppi::initialize { "${name}-Deploy_Files": |
|
254 priority => '40' , |
|
255 command => 'get_file.sh' , |
|
256 arguments => "-s ${document_init_source} -d ${deploy_root}" , |
|
257 user => $document_real_user , |
|
258 project => $name , |
|
259 enable => $enable , |
|
260 } |
|
261 } |
|
262 |
|
263 if ($config_init_source != '') { |
|
264 puppi::initialize { "${name}-Deploy_CFG_Files": |
|
265 priority => '40' , |
|
266 command => 'get_file.sh' , |
|
267 arguments => "-s ${config_init_source} -d ${deploy_root}" , |
|
268 user => $config_real_user , |
|
269 project => $name , |
|
270 enable => $enable , |
|
271 } |
|
272 } |
|
273 |
|
274 ### DEPLOY SEQUENCE |
|
275 if ($bool_run_checks == true) { |
|
276 puppi::deploy { "${name}-Run_PRE-Checks": |
|
277 priority => '10' , |
|
278 command => 'check_project.sh' , |
|
279 arguments => $name , |
|
280 user => 'root' , |
|
281 project => $name , |
|
282 enable => $enable , |
|
283 } |
|
284 } |
|
285 |
|
286 # First: hybrisServer-Platform |
|
287 $platform_metadata_arguments = $http_password ? { |
|
288 '' => "-s ${source}/hybrisServer-Platform/maven-metadata.xml -t maven-metadata -a ${real_always_deploy}" , |
|
289 default => "-s ${source}/hybrisServer-Platform/maven-metadata.xml -t maven-metadata -a ${real_always_deploy} -u ${http_user} -p ${http_password}" |
|
290 } |
|
291 |
|
292 puppi::deploy { "${name}-Get_Maven_Metadata_hybrisServer-Platform_File": |
|
293 priority => '20' , |
|
294 command => 'get_file.sh' , |
|
295 arguments => $platform_metadata_arguments, |
|
296 user => 'root' , |
|
297 project => $name , |
|
298 enable => $enable , |
|
299 } |
|
300 |
|
301 puppi::deploy { "${name}-Extract_Maven_Metadata_hybrisServer-Platform": |
|
302 priority => '21' , |
|
303 command => 'get_metadata.sh' , |
|
304 arguments => "-m ${document_suffix} -mc ${config_suffix} -mj ${jar_suffix} -mw ${war_suffix} -mz ${zip_suffix} -at ${artifact_type}" , |
|
305 user => 'root' , |
|
306 project => $name , |
|
307 enable => $enable , |
|
308 } |
|
309 |
|
310 # Files retrieval |
|
311 $platform_zipfile_arguments = $http_password ? { |
|
312 '' => "${source}/hybrisServer-Platform zipfile", |
|
313 default => "-u ${http_user} -p ${http_password} ${source}/hybrisServer-Platform zipfile", |
|
314 } |
|
315 |
|
316 if ($deploy_root != '') { |
|
317 puppi::deploy { "${name}-Get_Maven_Files_ZIP_hybrisServer-Platform": |
|
318 priority => '22' , |
|
319 command => 'get_maven_files.sh' , |
|
320 arguments => $platform_zipfile_arguments, |
|
321 user => 'root' , |
|
322 project => $name , |
|
323 enable => $enable , |
|
324 } |
|
325 } |
|
326 |
|
327 # Second: hybrisServer-AllExtensions |
|
328 $extensions_metadata_arguments = $http_password ? { |
|
329 '' => "-s ${source}/hybrisServer-AllExtensions/maven-metadata.xml -t maven-metadata -a ${real_always_deploy}", |
|
330 default => "-s ${source}/hybrisServer-AllExtensions/maven-metadata.xml -t maven-metadata -a ${real_always_deploy} -u ${http_user} -p ${http_password}", |
|
331 } |
|
332 |
|
333 puppi::deploy { "${name}-Get_Maven_Metadata_hybrisServer-AllExtensions_File": |
|
334 priority => '23' , |
|
335 command => 'get_file.sh' , |
|
336 arguments => $extensions_metadata_arguments, |
|
337 user => 'root' , |
|
338 project => $name , |
|
339 enable => $enable , |
|
340 } |
|
341 |
|
342 puppi::deploy { "${name}-Extract_Maven_Metadata_hybrisServer-AllExtensions": |
|
343 priority => '24' , |
|
344 command => 'get_metadata.sh' , |
|
345 arguments => "-m ${document_suffix} -mc ${config_suffix} -mj ${jar_suffix} -mw ${war_suffix} -mz ${zip_suffix} -at ${artifact_type}" , |
|
346 user => 'root' , |
|
347 project => $name , |
|
348 enable => $enable , |
|
349 } |
|
350 |
|
351 # Files retrieval |
|
352 if ($deploy_root != '') { |
|
353 $extensions_zipfile_arguments = $http_password ? { |
|
354 '' => "${source}/hybrisServer-AllExtensions zipfile", |
|
355 default => "-u ${http_user} -p ${http_password} ${source}/hybrisServer-AllExtensions zipfile", |
|
356 } |
|
357 |
|
358 puppi::deploy { "${name}-Get_Maven_Files_ZIP_hybrisServer-AllExtensions": |
|
359 priority => '25' , |
|
360 command => 'get_maven_files.sh' , |
|
361 arguments => $extensions_zipfile_arguments, |
|
362 user => 'root' , |
|
363 project => $name , |
|
364 enable => $enable , |
|
365 } |
|
366 } |
|
367 |
|
368 |
|
369 if ($config_root != '') { |
|
370 # Third: config-tarball (optional, right now not supported) |
|
371 $config_metadata_arguments = $http_password ? { |
|
372 '' => "-s ${source}/config/maven-metadata.xml -t maven-metadata -a ${real_always_deploy}", |
|
373 default => "-s ${source}/config/maven-metadata.xml -t maven-metadata -a ${real_always_deploy} -u ${http_user} -p ${http_password}" |
|
374 } |
|
375 |
|
376 puppi::deploy { "${name}-Get_Maven_Metadata_config-tarball_File": |
|
377 priority => '26' , |
|
378 command => 'get_file.sh' , |
|
379 arguments => $config_metadata_arguments, |
|
380 user => 'root' , |
|
381 project => $name , |
|
382 enable => $enable , |
|
383 } |
|
384 |
|
385 puppi::deploy { "${name}-Extract_Maven_Metadata_config-tarball": |
|
386 priority => '27' , |
|
387 command => 'get_metadata.sh' , |
|
388 arguments => "-m ${document_suffix} -mc ${config_suffix} -mj ${jar_suffix} -mw ${war_suffix} -mz ${zip_suffix} -at ${artifact_type}" , |
|
389 user => 'root' , |
|
390 project => $name , |
|
391 enable => $enable , |
|
392 } |
|
393 |
|
394 puppi::deploy { "${name}-Get_Maven_Files_Config": |
|
395 priority => '28' , |
|
396 command => 'get_maven_files.sh' , |
|
397 arguments => "${source} configfile" , |
|
398 user => 'root' , |
|
399 project => $name , |
|
400 enable => $enable , |
|
401 } |
|
402 } |
|
403 |
|
404 if ($firewall_src_ip != '') { |
|
405 puppi::deploy { "${name}-Load_Balancer_Block": |
|
406 priority => '30' , |
|
407 command => 'firewall.sh' , |
|
408 arguments => "${firewall_src_ip} ${firewall_dst_port} on ${firewall_delay}" , |
|
409 user => 'root', |
|
410 project => $name , |
|
411 enable => $enable , |
|
412 } |
|
413 } |
|
414 |
|
415 # Existing files backup |
|
416 if ($deploy_root != '') { |
|
417 puppi::deploy { "${name}-Backup_Existing_WAR": |
|
418 priority => '30' , |
|
419 command => 'archive.sh' , |
|
420 arguments => "-b ${deploy_root} -t war -s move -m diff -o '${backup_rsync_options}' -n ${backup_retention}" , |
|
421 user => 'root' , |
|
422 project => $name , |
|
423 enable => $enable , |
|
424 } |
|
425 } |
|
426 |
|
427 if ($jar_root != '') { |
|
428 puppi::deploy { "${name}-Backup_Existing_JAR": |
|
429 priority => '30' , |
|
430 command => 'archive.sh' , |
|
431 arguments => "-b ${jar_root} -t jar -s move -m diff -o '${backup_rsync_options}' -n ${backup_retention}" , |
|
432 user => 'root' , |
|
433 project => $name , |
|
434 enable => $enable , |
|
435 } |
|
436 } |
|
437 |
|
438 if ($config_root != '') { |
|
439 puppi::deploy { "${name}-Backup_Existing_ConfigDir": |
|
440 priority => '30' , |
|
441 command => 'archive.sh' , |
|
442 arguments => "-b ${config_root} -t config -d predeploydir_configfile -o '${backup_rsync_options}' -n ${backup_retention}" , |
|
443 user => 'root' , |
|
444 project => $name , |
|
445 enable => $enable , |
|
446 } |
|
447 } |
|
448 |
|
449 if ($document_root != '') { |
|
450 puppi::deploy { "${name}-Backup_Existing_DocumentDir": |
|
451 priority => '30' , |
|
452 command => 'archive.sh' , |
|
453 arguments => "-b ${document_root} -t docroot -d predeploydir_configfile -o '${backup_rsync_options}' -n ${backup_retention}" , |
|
454 user => 'root' , |
|
455 project => $name , |
|
456 enable => $enable , |
|
457 } |
|
458 } |
|
459 |
|
460 if ($disable_services != '') { |
|
461 puppi::deploy { "${name}-Disable_extra_services": |
|
462 priority => '36' , |
|
463 command => 'service.sh' , |
|
464 arguments => "stop ${disable_services}" , |
|
465 user => 'root', |
|
466 project => $name , |
|
467 enable => $enable , |
|
468 } |
|
469 } |
|
470 |
|
471 if ($init_script != '') { |
|
472 puppi::deploy { "${name}-Service_stop": |
|
473 priority => '38' , |
|
474 command => 'service.sh' , |
|
475 arguments => "stop ${init_script}" , |
|
476 user => 'root', |
|
477 project => $name , |
|
478 enable => $enable , |
|
479 } |
|
480 } |
|
481 |
|
482 if ($predeploy_customcommand != '') { |
|
483 puppi::deploy { "${name}-Run_Custom_PreDeploy_Script": |
|
484 priority => $predeploy_priority , |
|
485 command => 'execute.sh' , |
|
486 arguments => $predeploy_customcommand , |
|
487 user => $predeploy_real_user , |
|
488 project => $name , |
|
489 enable => $enable , |
|
490 } |
|
491 } |
|
492 |
|
493 # Deploys |
|
494 if ($deploy_root != '') { |
|
495 puppi::deploy { "${name}-Deploy_Maven_ZIP": |
|
496 priority => '40' , |
|
497 command => 'deploy.sh' , |
|
498 arguments => "${deploy_root} predeploydir_zipfile ", |
|
499 user => $user , |
|
500 project => $name , |
|
501 enable => $enable , |
|
502 } |
|
503 } |
|
504 |
|
505 if ($config_root != '') { |
|
506 puppi::deploy { "${name}-Deploy_ConfigDir": |
|
507 priority => '40' , |
|
508 command => 'deploy.sh' , |
|
509 arguments => "${config_root} predeploydir_configfile" , |
|
510 user => $config_real_user , |
|
511 project => $name , |
|
512 enable => $enable , |
|
513 } |
|
514 } |
|
515 |
|
516 puppi::deploy { "${name}-yant": |
|
517 priority => '42' , |
|
518 command => 'yant.sh' , |
|
519 arguments => "${deploy_root} clean all" , |
|
520 user => $user , |
|
521 project => $name , |
|
522 enable => $enable , |
|
523 } |
|
524 |
|
525 if ($postdeploy_customcommand != '') { |
|
526 puppi::deploy { "${name}-Run_Custom_PostDeploy_Script": |
|
527 priority => $postdeploy_priority , |
|
528 command => 'execute.sh' , |
|
529 arguments => $postdeploy_customcommand , |
|
530 user => $postdeploy_real_user , |
|
531 project => $name , |
|
532 enable => $enable , |
|
533 } |
|
534 } |
|
535 |
|
536 if ($init_script != '') { |
|
537 puppi::deploy { "${name}-Service_start": |
|
538 priority => '44' , |
|
539 command => 'service.sh' , |
|
540 arguments => "start ${init_script}" , |
|
541 user => 'root', |
|
542 project => $name , |
|
543 enable => $enable , |
|
544 } |
|
545 } |
|
546 |
|
547 if ($disable_services != '') { |
|
548 puppi::deploy { "${name}-Enable_extra_services": |
|
549 priority => '45' , |
|
550 command => 'service.sh' , |
|
551 arguments => "start ${disable_services}" , |
|
552 user => 'root', |
|
553 project => $name , |
|
554 enable => $enable , |
|
555 } |
|
556 } |
|
557 |
|
558 if ($firewall_src_ip != '') { |
|
559 puppi::deploy { "${name}-Load_Balancer_Unblock": |
|
560 priority => '47' , |
|
561 command => 'firewall.sh' , |
|
562 arguments => "${firewall_src_ip} ${firewall_dst_port} off 0" , |
|
563 user => 'root', |
|
564 project => $name , |
|
565 enable => $enable , |
|
566 } |
|
567 } |
|
568 |
|
569 if ($bool_run_checks == true) { |
|
570 puppi::deploy { "${name}-Run_POST-Checks": |
|
571 priority => '80' , |
|
572 command => 'check_project.sh' , |
|
573 arguments => $name , |
|
574 user => 'root' , |
|
575 project => $name , |
|
576 enable => $enable , |
|
577 } |
|
578 } |
|
579 |
|
580 |
|
581 ### ROLLBACK PROCEDURE |
|
582 |
|
583 if ($firewall_src_ip != '') { |
|
584 puppi::rollback { "${name}-Load_Balancer_Block": |
|
585 priority => '25' , |
|
586 command => 'firewall.sh' , |
|
587 arguments => "${firewall_src_ip} ${firewall_dst_port} on ${firewall_delay}" , |
|
588 user => 'root', |
|
589 project => $name , |
|
590 enable => $enable , |
|
591 } |
|
592 } |
|
593 |
|
594 if ($disable_services != '') { |
|
595 puppi::rollback { "${name}-Disable_extra_services": |
|
596 priority => '37' , |
|
597 command => 'service.sh' , |
|
598 arguments => "stop ${disable_services}" , |
|
599 user => 'root', |
|
600 project => $name , |
|
601 enable => $enable , |
|
602 } |
|
603 } |
|
604 |
|
605 if ($init_script != '') { |
|
606 puppi::rollback { "${name}-Service_stop": |
|
607 priority => '38' , |
|
608 command => 'service.sh' , |
|
609 arguments => "stop ${init_script}" , |
|
610 user => 'root', |
|
611 project => $name , |
|
612 enable => $enable , |
|
613 } |
|
614 } |
|
615 |
|
616 if ($predeploy_customcommand != '') { |
|
617 puppi::rollback { "${name}-Run_Custom_PreDeploy_Script": |
|
618 priority => $predeploy_priority , |
|
619 command => 'execute.sh' , |
|
620 arguments => $predeploy_customcommand , |
|
621 user => $predeploy_real_user , |
|
622 project => $name , |
|
623 enable => $enable , |
|
624 } |
|
625 } |
|
626 |
|
627 if ($deploy_root != '') { |
|
628 puppi::rollback { "${name}-Recover_ZIP": |
|
629 priority => '40' , |
|
630 command => 'archive.sh' , |
|
631 arguments => "-r ${deploy_root} -t zip -o '${backup_rsync_options}'" , |
|
632 user => $user , |
|
633 project => $name , |
|
634 enable => $enable , |
|
635 } |
|
636 } |
|
637 |
|
638 if ($config_root != '') { |
|
639 puppi::rollback { "${name}-Recover_ConfigDir": |
|
640 priority => '40' , |
|
641 command => 'archive.sh' , |
|
642 arguments => "-r ${config_root} -t config -o '${backup_rsync_options}'" , |
|
643 user => $config_real_user , |
|
644 project => $name , |
|
645 enable => $enable , |
|
646 } |
|
647 } |
|
648 |
|
649 if ($postdeploy_customcommand != '') { |
|
650 puppi::rollback { "${name}-Run_Custom_PostDeploy_Script": |
|
651 priority => $postdeploy_priority , |
|
652 command => 'execute.sh' , |
|
653 arguments => $postdeploy_customcommand , |
|
654 user => $postdeploy_real_user , |
|
655 project => $name , |
|
656 enable => $enable , |
|
657 } |
|
658 } |
|
659 |
|
660 if ($init_script != '') { |
|
661 puppi::rollback { "${name}-Service_start": |
|
662 priority => '42' , |
|
663 command => 'service.sh' , |
|
664 arguments => "start ${init_script}" , |
|
665 user => 'root', |
|
666 project => $name , |
|
667 enable => $enable , |
|
668 } |
|
669 } |
|
670 |
|
671 if ($disable_services != '') { |
|
672 puppi::rollback { "${name}-Enable_extra_services": |
|
673 priority => '44' , |
|
674 command => 'service.sh' , |
|
675 arguments => "start ${disable_services}" , |
|
676 user => 'root', |
|
677 project => $name , |
|
678 enable => $enable , |
|
679 } |
|
680 } |
|
681 |
|
682 if ($firewall_src_ip != '') { |
|
683 puppi::rollback { "${name}-Load_Balancer_Unblock": |
|
684 priority => '46' , |
|
685 command => 'firewall.sh' , |
|
686 arguments => "${firewall_src_ip} ${firewall_dst_port} off 0" , |
|
687 user => 'root', |
|
688 project => $name , |
|
689 enable => $enable , |
|
690 } |
|
691 } |
|
692 |
|
693 if ($bool_run_checks == true) { |
|
694 puppi::rollback { "${name}-Run_POST-Checks": |
|
695 priority => '80' , |
|
696 command => 'check_project.sh' , |
|
697 arguments => $name , |
|
698 user => 'root' , |
|
699 project => $name , |
|
700 enable => $enable , |
|
701 } |
|
702 } |
|
703 |
|
704 |
|
705 ### REPORTING |
|
706 |
|
707 if ($report_email != '') { |
|
708 puppi::report { "${name}-Mail_Notification": |
|
709 priority => '20' , |
|
710 command => 'report_mail.sh' , |
|
711 arguments => $report_email , |
|
712 user => 'root', |
|
713 project => $name , |
|
714 enable => $enable , |
|
715 } |
|
716 } |
|
717 |
|
718 ### AUTO DEPLOY DURING PUPPET RUN |
|
719 if ($bool_auto_deploy == true) { |
|
720 puppi::run { $name: } |
|
721 } |
|
722 |
|
723 } |