288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
|
# File 'manifests/init.pp', line 288
class jira (
# Jira Settings
String $version = '8.13.5',
String[1] $product = 'jira',
Stdlib::Absolutepath $installdir = '/opt/jira',
Stdlib::Absolutepath $homedir = '/home/jira',
Boolean $manage_homedir = true,
Boolean $manage_user = true,
String $user = 'jira',
String $group = 'jira',
String[1] $installdir_owner = 'root',
String[1] $installdir_group = 'root',
Stdlib::Filemode $installdir_mode = '0755',
Optional[Stdlib::Filemode] $homedir_mode = undef,
Optional[Integer[0]] $uid = undef,
Optional[Integer[0]] $gid = undef,
Stdlib::Absolutepath $shell = '/bin/true',
# Advanced configuration options
Boolean $enable_secure_admin_sessions = true,
Hash $jira_config_properties = {},
Boolean $datacenter = false,
Optional[Stdlib::AbsolutePath] $shared_homedir = undef,
Optional[Stdlib::Host] $ehcache_listener_host = undef,
Optional[Stdlib::Port] $ehcache_listener_port = undef,
Optional[Stdlib::Port] $ehcache_object_port = undef,
# Database Settings
Boolean $use_jndi_ds = false,
String[1] $jndi_ds_name = 'JiraDS',
Enum['postgresql','mysql','sqlserver','oracle','h2'] $db = 'postgresql',
Boolean $change_dbpassword = false,
String $dbuser = 'jiraadm',
String $dbpassword = 'mypassword',
String $dbserver = 'localhost',
String $dbname = 'jira',
Optional[Variant[Integer,String]] $dbport = undef,
Optional[String] $dbdriver = undef,
Optional[String] $dbtype = undef,
Optional[String] $dburl = undef,
Optional[String] $connection_settings = undef,
Boolean $oracle_use_sid = true,
Optional[String[1]] $dbschema = undef,
# MySQL Connector Settings
Boolean $mysql_connector_manage = true,
String $mysql_connector_version = '8.0.23',
String $mysql_connector_product = 'mysql-connector-java',
String $mysql_connector_format = 'tar.gz',
Stdlib::Absolutepath $mysql_connector_install = '/opt/MySQL-connector',
Stdlib::HTTPUrl $mysql_connector_url = 'https://dev.mysql.com/get/Downloads/Connector-J',
Optional[Integer[0]] $pool_min_size = undef,
Optional[Integer[0]] $pool_max_size = undef,
Optional[Integer[-1]] $pool_max_wait = undef,
Optional[String] $validation_query = undef,
Optional[Integer[0]] $validation_query_timeout = undef,
Optional[Integer[0]] $min_evictable_idle_time = undef,
Optional[Integer[0]] $time_between_eviction_runs = undef,
Optional[Integer[0]] $pool_max_idle = undef,
Optional[Boolean] $pool_remove_abandoned = undef,
Optional[Integer[0]] $pool_remove_abandoned_timeout = undef,
Optional[Boolean] $pool_test_while_idle = undef,
Optional[Boolean] $pool_test_on_borrow = undef,
# JVM Settings
Optional[String[1]] $java_package = undef,
Optional[Stdlib::AbsolutePath] $javahome = undef,
Jira::Jvm_types $jvm_type = 'openjdk-11',
String $jvm_xms = '256m',
String $jvm_xmx = '1024m',
Optional[String] $java_opts = undef,
Optional[String] $jvm_gc_args = undef,
Optional[String] $jvm_code_cache_args = undef,
Optional[String] $jvm_extra_args = undef,
Integer $jvm_nofiles_limit = 16384,
# Misc Settings
Stdlib::HTTPUrl $download_url = 'https://product-downloads.atlassian.com/software/jira/downloads',
Optional[String] $checksum = undef,
Boolean $disable_notifications = false,
Optional[String] $proxy_server = undef,
Optional[Enum['none','http','https','ftp']] $proxy_type = undef,
# Manage service
Boolean $service_manage = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_enable = true,
$service_notify = undef,
$service_subscribe = undef,
# Command to stop jira in preparation to upgrade. This is configurable
# in case the jira service is managed outside of puppet. eg: using the
# puppetlabs-corosync module: 'crm resource stop jira && sleep 15'
# Note: the command should return either 0 or 5 when the service doesn't exist
String $stop_jira = 'systemctl stop jira.service && sleep 15',
# Whether to manage the 'check-java.sh' script, and where to retrieve
# the script from.
Boolean $script_check_java_manage = false,
String $script_check_java_template = 'jira/check-java.sh.erb',
# Tomcat
Optional[String] $tomcat_address = undef,
Stdlib::Port $tomcat_port = 8080,
Stdlib::Port $tomcat_shutdown_port = 8005,
Integer $tomcat_max_http_header_size = 8192,
Integer[0] $tomcat_min_spare_threads = 25,
Integer[0] $tomcat_connection_timeout = 20000,
Boolean $tomcat_enable_lookups = false,
Boolean $tomcat_native_ssl = false,
Stdlib::Port $tomcat_https_port = 8443,
Optional[Stdlib::Port] $tomcat_redirect_https_port = undef,
String $tomcat_protocol = 'HTTP/1.1',
Optional[String] $tomcat_protocol_ssl = undef,
Boolean $tomcat_use_body_encoding_for_uri = true,
Boolean $tomcat_disable_upload_timeout = true,
String $tomcat_key_alias = 'jira',
Stdlib::Absolutepath $tomcat_keystore_file = '/home/jira/jira.jks',
String $tomcat_keystore_pass = 'changeit',
Enum['JKS', 'JCEKS', 'PKCS12'] $tomcat_keystore_type = 'JKS',
String $tomcat_accesslog_format = '%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r"',
Boolean $tomcat_accesslog_enable_xforwarded_for = false,
# Tomcat Tunables
Integer $tomcat_max_threads = 150,
Integer $tomcat_accept_count = 100,
# Reverse https proxy
Hash $proxy = {},
# Options for the AJP connector
Hash $ajp = {},
Boolean $tomcat_default_connector = true,
# Additional connectors in server.xml
Jira::Tomcat_connectors $tomcat_additional_connectors = {},
# Context path (usualy used in combination with a reverse proxy)
Optional[String[1]] $contextpath = undef,
# Resources for context.xml
Hash $resources = {},
# Enable SingleSignOn via Crowd
Boolean $enable_sso = false,
String $application_name = 'crowd',
String $application_password = '1234',
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $application_login_url = 'https://crowd.example.com/console/',
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $crowd_server_url = 'https://crowd.example.com/services/',
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $crowd_base_url = 'https://crowd.example.com/',
String $session_isauthenticated = 'session.isauthenticated',
String $session_tokenkey = 'session.tokenkey',
Integer $session_validationinterval = 5,
String $session_lastvalidation = 'session.lastvalidation',
# Deprecated parameters
Optional[String] $jvm_permgen = undef,
Optional[Integer[0]] $poolsize = undef,
Optional[Boolean] $enable_connection_pooling = undef,
# plugin installation
Array[Hash] $plugins = [],
) {
# To maintain compatibility with previous behaviour, we check for not-servicedesk instead of specifying the
if $product != 'servicedesk' and versioncmp($jira::version, '8.0.0') < 0 {
fail('JIRA versions older than 8.0.0 are no longer supported. Please use an older version of this module to upgrade first.')
}
if $product == 'servicedesk' and versioncmp($jira::version, '4.10.0') < 0 {
fail('JIRA servicedesk versions older than 4.10.0 are no longer supported. Please use an older version of this module to upgrade first.')
}
if $datacenter and !$shared_homedir {
fail("\$shared_homedir must be set when \$datacenter is true")
}
if $jvm_permgen {
fail('jira::jvm_permgen', 'jira::jvm_permgen has been removed and no longer does anything. Configuring it hasn\'t been supported since JDK 8')
}
if $enable_connection_pooling != undef {
deprecation('jira::enable_connection_pooling', 'jira::enable_connection_pooling has been removed and does nothing. Please simply configure the connection pooling parameters')
}
if $tomcat_redirect_https_port {
unless ($tomcat_native_ssl) {
fail('You need to set native_ssl to true when using tomcat_redirect_https_port')
}
}
# The default Jira product starting with version 7 is 'jira-software',
# but some old configuration may explicitly specify 'jira'
if $product == 'jira' {
$product_name = 'jira-software'
} else {
$product_name = $product
}
$webappdir = "${installdir}/atlassian-${product_name}-${version}-standalone"
if ! empty($ajp) {
if ! ('port' in $ajp) {
fail('You need to specify a valid port for the AJP connector.')
} else {
assert_type(Variant[Pattern[/^\d+$/], Stdlib::Port], $ajp['port'])
}
if ! ('protocol' in $ajp) {
fail('You need to specify a valid protocol for the AJP connector.')
} else {
assert_type(Enum['AJP/1.3', 'org.apache.coyote.ajp', 'org.apache.coyote.ajp.AjpNioProtocol'], $ajp['protocol'])
}
}
if $javahome == undef {
fail('You need to specify a value for javahome')
}
$is_insalled_deferred = Deferred('jira::is_installed', [$jira::homedir])
$is_installed = $is_insalled_deferred =~ Deferred ? {
true => jira::is_installed($jira::homedir),
false => $is_insalled_deferred
}
if $is_installed {
# use the parameter if the fact did not run (confine), or the fact shows that there is a dbconfig.xml in place
$change_dbpassword_real = versioncmp($version, '10.3.0') ? {
-1 => true,
default => $change_dbpassword,
}
}
else {
# jira probably not installed
$change_dbpassword_real = true
}
contain jira::install
contain jira::config
contain jira::service
Class['jira::install']
-> Class['jira::config']
~> Class['jira::service']
if ($enable_sso) {
class { 'jira::sso': }
}
# install any given library or remove them
$plugins.each |Hash $plugin_data| {
$target = "${jira::webappdir}/atlassian-jira/WEB-INF/lib/${$plugin_data['installation_name']}"
if $plugin_data['ensure'] == 'absent' {
archive {
$target:
ensure => 'absent',
}
} else {
$_target_defaults = {
ensure => 'present',
source => $plugin_data['source'],
checksum => $plugin_data['checksum'],
checksum_type => $plugin_data['checksum_type'],
}
$_username = !empty($plugin_data['username']) ? {
default => {},
true => { username => $plugin_data['username'] }
}
$_password = !empty($plugin_data['password']) ? {
default => {},
true => { password => $plugin_data['password'] },
}
$_plugin_archive = {
$target => $_target_defaults + $_username + $_password,
}
create_resources(archive, $_plugin_archive)
}
}
}
|