Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Gemfile.lock
pkg
spec/fixtures/
.vagrant/
.idea/
log/
vendor/
bin/
23 changes: 12 additions & 11 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@
# Copyright 2013 Hubspot
#
class nexus::service (
$nexus_home = $::nexus::nexus_home,
$nexus_user = $::nexus::nexus_user,
$nexus_home = $::nexus::nexus_home,
$nexus_user = $::nexus::nexus_user,
$nexus_group = $::nexus::nexus_group,
$version = $::nexus::version,
$version = $::nexus::version,
) {
$nexus_script = "${nexus_home}/bin/nexus"

if ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8.0') > 0) or
($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '15.04') > 0) or
(($::operatingsystem == 'CentOS' or $::operatingsystem == 'RedHat') and versioncmp($::operatingsystemmajrelease, '7') >= 0) {
($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '15.04') > 0) or
(($::operatingsystem == 'CentOS' or $::operatingsystem == 'RedHat' or $::operatingsystem == 'OracleLinux') and
versioncmp($::operatingsystemmajrelease, '7') >= 0) {
file { '/lib/systemd/system/nexus.service':
mode => '0644',
owner => 'root',
Expand All @@ -58,13 +59,13 @@

} else {

file_line{ 'nexus_NEXUS_HOME':
file_line { 'nexus_NEXUS_HOME':
path => $nexus_script,
match => '^#?NEXUS_HOME=',
line => "NEXUS_HOME=${nexus_home}",
}

file{ '/etc/init.d/nexus':
file { '/etc/init.d/nexus':
ensure => 'link',
target => $nexus_script,
require => [
Expand All @@ -77,7 +78,7 @@
if $version !~ /\d.*/ or versioncmp($version, '3.0.0') >= 0 {
$status_line = "env run_as_user=${nexus_user} /etc/init.d/nexus status"

file_line{ 'nexus_RUN_AS_USER':
file_line { 'nexus_RUN_AS_USER':
path => $nexus_script,
match => '^run_as_user\=',
line => "run_as_user=\${run_as_user:-${nexus_user}}",
Expand All @@ -86,20 +87,20 @@
} else {
$status_line = 'env run_as_user=root /etc/init.d/nexus status'

file_line{ 'nexus_RUN_AS_USER':
file_line { 'nexus_RUN_AS_USER':
path => $nexus_script,
match => '^#?RUN_AS_USER=',
line => "RUN_AS_USER=\${run_as_user:-${nexus_user}}",
}
}

service{ 'nexus':
service { 'nexus':
ensure => running,
enable => true,
status => $status_line,
require => [File['/etc/init.d/nexus'],
File_line['nexus_NEXUS_HOME'],
File_line['nexus_RUN_AS_USER'],]
File_line['nexus_RUN_AS_USER'], ]
}
}
}