66 if $facts['os']['family'] == 'RedHat' {
77 $java_package = 'java-17-openjdk'
88 $java_home = '/usr/lib/jvm/jre-17-openjdk'
9- $postgresql_version = '13'
109 $pgsql_package_name = 'postgresql-server'
1110 $pgsql_data_dir = '/var/lib/pgsql'
12-
13- $manage_dnf_module = $facts['os']['release']['major'] ? {
14- '8' => true,
15- default => false, # RHEL-9 has pgsql 13 as a default
16- }
17-
1811 $autoremove_command = 'dnf --exclude="systemd*" autoremove -y'
1912 } elsif $facts['os']['family'] == 'Debian' {
20- $postgresql_version = $facts['os']['release']['major'] ? {
21- '11' => '13',
22- default => '14',
23- }
24-
2513 $java_package = 'openjdk-17-jre'
2614 $java_home = '/usr/lib/jvm/java-17-openjdk-amd64'
27- $pgsql_package_name = "postgresql-${postgresql_version}"
28- $pgsql_data_dir = "/var/lib/postgresql/${postgresql_version}/main/"
29- $manage_dnf_module = false
15+ $pgsql_package_name = 'postgresql-15'
16+ $pgsql_data_dir = '/var/lib/postgresql/15/main/'
3017 $autoremove_command = 'apt autoremove -y'
3118 }
32-
33- $jira_install_dir = '/opt/jira/'
34- $postgres_service = 'postgresql'
35- $jira_service = 'jira'
3619EOS
3720
3821pp = <<-EOS
3922 # The output of `systemctl status postgresql` is non ascii which
4023 # breaks the Exec in Postgresql::Server::Instance::Reload
4124 # on rhel based docker containers
4225 # We don't need the output.
43- class { 'postgresql::globals':
44- manage_dnf_module => $manage_dnf_module,
45- version => $postgresql_version,
46- }
47-
4826 class { 'postgresql::server':
4927 service_status => 'systemctl status postgresql > /dev/null',
5028 needs_initdb => true,
5129 }
5230
5331 postgresql::server::db { 'jira':
5432 user => 'jiraadm',
33+ grant => 'ALL',
5534 password => postgresql::postgresql_password('jiraadm', 'mypassword'),
5635 }
5736
37+ # This is needed for postgresql 15 but is backwards compatible
38+ postgresql::server::grant { 'jira':
39+ db => 'jira',
40+ object_type => 'SCHEMA',
41+ object_name => 'public',
42+ privilege => 'ALL',
43+ role => 'jiraadm',
44+ require => Postgresql::Server::Db['jira'],
45+ }
46+
5847 class { 'jira':
59- version => '10.3.2',
60- java_package => $java_package,
61- javahome => $java_home,
62- connection_settings => 'tcpKeepAlive=true',
63- require => Postgresql::Server::Db['jira'],
48+ version => '10.3.2',
49+ java_package => $java_package,
50+ javahome => $java_home,
51+ require => Postgresql::Server::Grant['jira'],
6452 }
6553EOS
6654
6755pp = pre + pp
6856
6957pp_upgrade = <<-EOS
7058 class { 'jira':
71- version => '10.3.3',
72- java_package => $java_package,
73- javahome => $java_home,
74- connection_settings => 'tcpKeepAlive=true',
59+ version => '10.3.3',
7560 }
7661EOS
7762
@@ -91,29 +76,22 @@ class { 'jira':
9176 ensure => purged,
9277 }
9378
94- if $manage_dnf_module {
95- exec { 'dnf module reset postgresql':
96- command => 'dnf module reset -y postgresql',
97- provider => shell,
98- }
99- }
100-
10179 exec { 'autoremove cleanup':
10280 command => $autoremove_command,
10381 provider => shell,
10482 }
10583
10684 exec { 'cleanup pgsql and JIRA install dir':
107- command => "rm -Rf ${pgsql_data_dir}/* ${$jira_install_dir} /atlassian-jira-software*",
85+ command => "rm -Rf ${pgsql_data_dir}/* /opt/jira /atlassian-jira-software*",
10886 provider => shell,
10987 require => Exec['autoremove cleanup'],
11088 }
11189
112- service { $postgres_service :
90+ service { 'postgresql' :
11391 ensure => stopped,
11492 }
11593
116- service { $jira_service :
94+ service { 'jira' :
11795 ensure => stopped,
11896 }
11997EOS
0 commit comments