Honor rgw_enable and mon_enable for systemd units

Consume rgw_enable and mon_enable parameters to set the 'enable'
state for the systemd units.

Also removes support for sysvinit as we don't support Hammer
in the master branch so we can default to systemd.

Change-Id: I1e0415f0b7f640b1b2d05abcc2e7781ad5bb35a3
Closes-Bug: 1622825
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Giulio Fidente 2016-09-13 15:40:31 +02:00 committed by Alex Schultz
parent d4cc06688c
commit 16889b71e9
6 changed files with 37 additions and 50 deletions

View File

@ -33,6 +33,9 @@
# If set to absent, it will stop the MON service and remove
# the associated data directory.
#
# [*mon_enable*] Whether to enable ceph-mon instance on boot.
# Optional. Default is true.
#
# [*public_addr*] The bind IP address.
# Optional. The IPv(4|6) address on which MON binds itself.
#
@ -56,6 +59,7 @@
#
define ceph::mon (
$ensure = present,
$mon_enable = true,
$public_addr = undef,
$cluster = undef,
$authentication_type = 'cephx',
@ -76,37 +80,27 @@ define ceph::mon (
$cluster_name = 'ceph'
}
# NOTE(aschultz): this is the service title for the mon service. It may be
# different than the actual service name.
$mon_service = "ceph-mon-${id}"
# For Ubuntu Trusty system
if $::service_provider == 'upstart' {
$init = 'upstart'
Service {
name => $mon_service,
name => "ceph-mon-${id}",
provider => $::ceph::params::service_provider,
start => "start ceph-mon id=${id}",
stop => "stop ceph-mon id=${id}",
status => "status ceph-mon id=${id}",
enable => $mon_enable,
}
}
elsif $::service_provider == 'systemd' {
# Everything else that is supported by puppet-ceph should run systemd.
} else {
$init = 'systemd'
Service {
name => $mon_service,
provider => $::ceph::params::service_provider,
start => "systemctl start ceph-mon@${id}",
stop => "systemctl stop ceph-mon@${id}",
status => "systemctl status ceph-mon@${id}",
}
# For Red Hat systems (not supporting Jewel now, only Hammer)
} else {
$init = 'sysvinit'
Service {
name => $mon_service,
provider => $::ceph::params::service_provider,
start => "service ceph start mon.${id}",
stop => "service ceph stop mon.${id}",
status => "service ceph status mon.${id}",
name => "ceph-mon@${id}",
enable => $mon_enable,
}
}

View File

@ -63,7 +63,7 @@ class ceph::params (
$user_radosgw = 'apache'
$pkg_fastcgi = 'mod_fastcgi'
$pkg_nsstools = 'nss-tools'
$service_provider = 'redhat'
$service_provider = 'systemd'
$pkg_policycoreutils = 'policycoreutils-python'
}

View File

@ -155,13 +155,17 @@ define ceph::rgw (
selinux_ignore_defaults => true,
}
# NOTE(aschultz): this is the radowsgw service title, it may be different
# than the actual service name
$rgw_service = "radosgw-${name}"
# service definition
# if Ubuntu does not use systemd
if $::service_provider == 'upstart' {
if $rgw_enable {
file { "${rgw_data}/done":
ensure => present,
before => Service["radosgw-${name}"],
before => Service[$rgw_service],
}
}
@ -173,41 +177,24 @@ define ceph::rgw (
provider => $::ceph::params::service_provider,
}
# Everything else that is supported by puppet-ceph should run systemd.
} elsif $::service_provider == 'systemd' {
Service {
name => "radosgw-${name}",
start => "systemctl start ceph-radosgw@${name}",
stop => "systemctl stop ceph-radosgw@${name}",
status => "systemctl status ceph-radosgw@${name}",
provider => $::ceph::params::service_provider,
}
} else {
if $rgw_enable {
file { "${rgw_data}/sysvinit":
ensure => present,
before => Service["radosgw-${name}"],
}
}
Service {
name => "radosgw-${name}",
start => 'service radosgw start',
stop => 'service radosgw stop',
status => 'service radosgw status',
provider => $::ceph::params::service_provider,
name => "ceph-radosgw@${name}",
enable => $rgw_enable,
}
}
service { "radosgw-${name}":
service { $rgw_service:
ensure => $rgw_ensure,
tag => ['ceph-radowsgw']
}
Ceph_config<||> -> Service["radosgw-${name}"]
Ceph_config<||> -> Service<| tag == 'ceph-radosgw' |>
Package<| tag == 'ceph' |> -> File['/var/lib/ceph/radosgw']
Package<| tag == 'ceph' |> -> File[$log_file]
File['/var/lib/ceph/radosgw']
-> File[$rgw_data]
-> Service["radosgw-${name}"]
File[$log_file] -> Service["radosgw-${name}"]
Ceph::Pool<||> -> Service["radosgw-${name}"]
-> Service<| tag == 'ceph-radosgw' |>
File[$log_file] -> Service<| tag == 'ceph-radosgw' |>
Ceph::Pool<||> -> Service<| tag == 'ceph-radosgw' |>
}

View File

@ -176,7 +176,7 @@ certutil -d ${nss_db_path} -L | grep ^signing_cert
-> File[$nss_db_path]
-> Exec["${name}-nssdb-ca"]
-> Exec["${name}-nssdb-signing"]
~> Service["radosgw-${name}"]
~> Service<| tag == 'ceph-radosgw' |>
} else {
ceph_config {
"client.${name}/nss_db_path": ensure => absent;

View File

@ -0,0 +1,10 @@
---
features:
- use mon_enable and rgw_enable to manage services on
boot.
other:
- removal of support for sysv service management for
ceph-mon and ceph-radosgw since master currently only supports
jewel and the current recommended ceph platforms are either systemd
or upstart based.
http://docs.ceph.com/docs/jewel/start/os-recommendations/#platforms

View File

@ -260,8 +260,6 @@ describe 'ceph::rgw' do
'selinux_ignore_defaults' => true,
})}
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/sysvinit') }
it { is_expected.to contain_service('radosgw-radosgw.gateway') }
end
@ -308,8 +306,6 @@ describe 'ceph::rgw' do
'selinux_ignore_defaults' => true,
} ) }
it { is_expected.to_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/sysvinit') }
it { is_expected.to contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
end