Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/master/systemd compatibility #90

Closed
Closed
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
18 changes: 18 additions & 0 deletions lib/facter/gitlab_systemd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Fact: gitlab_systemd
#
# Purpose:
# Determine whether SystemD is the init system on the node
#
# Resolution:
# Check the name of the process 1 (ps -p 1)
#
# Caveats:
# Duplicates the fact "systemd" from camptocamp/puppet-systemd
#

Facter.add(:gitlab_systemd) do
confine :kernel => :linux
setcode do
Facter::Util::Resolution.exec('ps -p 1 -o comm=') == 'systemd'
end
end
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
# Default: true
# Run the system service on boot.
#
# [*service_initd_ensure*]
# Default for systemd systems, as determined by the $::gitlab_systemd fact: "absent"
# Else: "link"
# Sets "ensure => 'absent'" or "ensure => 'link'" on init.d softlink
# depending on the $::gitlab_systemd fact to avoid conflicts with systemd.
#
# [*service_exec*]
# Default: '/usr/bin/gitlab-ctl'
# The service executable path.
Expand Down Expand Up @@ -253,6 +259,7 @@
$package_pin = $::gitlab::params::package_pin,
# system service configuration
$service_enable = $::gitlab::params::service_enable,
$service_initd_ensure = $::gitlab::params::service_initd_ensure,
$service_ensure = $::gitlab::params::service_ensure,
$service_group = $::gitlab::params::service_group,
$service_hasrestart = $::gitlab::params::service_hasrestart,
Expand Down
6 changes: 6 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
$service_enable = true
}

if ($::gitlab_systemd) {
$service_initd_ensure = 'absent'
} else {
$service_initd_ensure = 'link'
}

# gitlab specific
$config_manage = true
$config_file = '/etc/gitlab/gitlab.rb'
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class gitlab::service {
if $::gitlab::service_manage {
file { "/etc/init.d/${::gitlab::service_name}":
ensure => 'link',
ensure => $::gitlab::service_initd_ensure,
target => $::gitlab::service_exec,
} ->
service { $::gitlab::service_name:
Expand Down