Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Use systemd unit for Ubuntu >= 16.04 #85

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions files/ubuntu_sonar.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/sonar
Description=LSB: Sonar
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
Before=shutdown.target
After=remote-fs.target
After=systemd-journald-dev-log.socket
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/sonar start
ExecStop=/etc/init.d/sonar stop
User=sonar
LimitNOFILE=65536
34 changes: 27 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,32 @@
ensure => directory,
}

service { 'sonarqube':
ensure => running,
name => $service,
hasrestart => true,
hasstatus => true,
enable => true,
require => File["/etc/init.d/${service}"],
if $::operatingsystem == 'Ubuntu' and
versioncmp($::operatingsystemrelease, '16.04') >= 0 {

# Install systemd unit for sonar

file {
'/etc/systemd/system/sonar.service':
content => file('sonarqube/ubuntu_sonar.service'),
require => File["/etc/init.d/${service}"]
} -> service { 'sonarqube':
ensure => running,
name => $service,
hasrestart => true,
hasstatus => true,
enable => true
}

} else {
service { 'sonarqube':
ensure => running,
name => $service,
hasrestart => true,
hasstatus => true,
enable => true,
require => File["/etc/init.d/${service}"],
}
}

}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=2.3.0 <5.0.0"
"version_requirement": ">=2.3.0 <7.0.0"
}
],
"operatingsystem_support": [
Expand Down