diff --git a/manifests/mon.pp b/manifests/mon.pp index 23e8730c..6cad7298 100644 --- a/manifests/mon.pp +++ b/manifests/mon.pp @@ -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, } } diff --git a/manifests/params.pp b/manifests/params.pp index f69d9aa9..381abe21 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' } diff --git a/manifests/rgw.pp b/manifests/rgw.pp index 29c245f2..8d8b5ebc 100644 --- a/manifests/rgw.pp +++ b/manifests/rgw.pp @@ -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' |> } diff --git a/manifests/rgw/keystone.pp b/manifests/rgw/keystone.pp index ccd6c273..e17e4e16 100644 --- a/manifests/rgw/keystone.pp +++ b/manifests/rgw/keystone.pp @@ -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; diff --git a/releasenotes/notes/service-management-9483b9cfc067c736.yaml b/releasenotes/notes/service-management-9483b9cfc067c736.yaml new file mode 100644 index 00000000..c15bd1d5 --- /dev/null +++ b/releasenotes/notes/service-management-9483b9cfc067c736.yaml @@ -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 diff --git a/spec/defines/ceph_rgw_spec.rb b/spec/defines/ceph_rgw_spec.rb index 8c955701..2a2bb4d3 100644 --- a/spec/defines/ceph_rgw_spec.rb +++ b/spec/defines/ceph_rgw_spec.rb @@ -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