allow to deployments on Ubuntu Xenial
From this patch, deployments should work on Ubuntu 16.04 LTS, that uses systemd by default. Instead of using operatingsystem, use service_provider to determine whether or not we want to run upstart scripts. Change-Id: I2435ad3153c667a9ffd01bd10b5c5b645d5b76fb
This commit is contained in:
parent
0d68c38980
commit
0117e4e06f
@ -64,6 +64,8 @@ define ceph::mon (
|
||||
$exec_timeout = $::ceph::params::exec_timeout,
|
||||
) {
|
||||
|
||||
include ::stdlib
|
||||
|
||||
# a puppet name translates into a ceph id, the meaning is different
|
||||
$id = $name
|
||||
|
||||
@ -74,17 +76,18 @@ define ceph::mon (
|
||||
$cluster_name = 'ceph'
|
||||
}
|
||||
|
||||
if $::operatingsystem == 'Ubuntu' {
|
||||
# if Ubuntu does not use systemd
|
||||
if $::service_provider == 'upstart' {
|
||||
$init = 'upstart'
|
||||
Service {
|
||||
name => "ceph-mon-${id}",
|
||||
# workaround for bug https://projects.puppetlabs.com/issues/23187
|
||||
provider => $::ceph::params::service_provider,
|
||||
start => "start ceph-mon id=${id}",
|
||||
stop => "stop ceph-mon id=${id}",
|
||||
status => "status ceph-mon id=${id}",
|
||||
}
|
||||
} elsif $::osfamily in ['RedHat', 'Debian'] {
|
||||
# Everything else that is supported by puppet-ceph should run systemd.
|
||||
} else {
|
||||
$init = 'sysvinit'
|
||||
Service {
|
||||
name => "ceph-mon-${id}",
|
||||
@ -93,8 +96,6 @@ define ceph::mon (
|
||||
stop => "service ceph stop mon.${id}",
|
||||
status => "service ceph status mon.${id}",
|
||||
}
|
||||
} else {
|
||||
fail("operatingsystem = ${::operatingsystem} is not supported")
|
||||
}
|
||||
|
||||
$mon_service = "ceph-mon-${id}"
|
||||
|
@ -84,6 +84,8 @@ define ceph::rgw (
|
||||
$syslog = true,
|
||||
) {
|
||||
|
||||
include ::stdlib
|
||||
|
||||
unless $name =~ /^radosgw\..+/ {
|
||||
fail("Define name must be started with 'radosgw.'")
|
||||
}
|
||||
@ -151,7 +153,8 @@ define ceph::rgw (
|
||||
}
|
||||
|
||||
# service definition
|
||||
if $::operatingsystem == 'Ubuntu' {
|
||||
# if Ubuntu does not use systemd
|
||||
if $::service_provider == 'upstart' {
|
||||
if $rgw_enable {
|
||||
file { "${rgw_data}/done":
|
||||
ensure => present,
|
||||
@ -166,7 +169,8 @@ define ceph::rgw (
|
||||
status => "status radosgw id=${name}",
|
||||
provider => $::ceph::params::service_provider,
|
||||
}
|
||||
} elsif ($::operatingsystem == 'Debian') or ($::osfamily == 'RedHat') {
|
||||
# Everything else that is supported by puppet-ceph should run systemd.
|
||||
} else {
|
||||
if $rgw_enable {
|
||||
file { "${rgw_data}/sysvinit":
|
||||
ensure => present,
|
||||
@ -179,11 +183,9 @@ define ceph::rgw (
|
||||
start => 'service radosgw start',
|
||||
stop => 'service radosgw stop',
|
||||
status => 'service radosgw status',
|
||||
provider => $::ceph::params::service_provider,
|
||||
}
|
||||
}
|
||||
else {
|
||||
fail("operatingsystem = ${::operatingsystem} is not supported")
|
||||
}
|
||||
|
||||
#for RHEL/CentOS7, systemctl needs to reload to pickup the ceph-radosgw init file
|
||||
if (($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '7') >= 0))
|
||||
|
3
releasenotes/notes/systemd-8b86dee2f9df5a14.yaml
Normal file
3
releasenotes/notes/systemd-8b86dee2f9df5a14.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Allow deployments on Ubuntu Xenial (systemd).
|
@ -22,12 +22,14 @@ require 'spec_helper'
|
||||
|
||||
describe 'ceph::mon' do
|
||||
|
||||
context 'Ubuntu' do
|
||||
context 'Ubuntu 14.04' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '14.04',
|
||||
:service_provider => 'upstart',
|
||||
}
|
||||
end
|
||||
|
||||
@ -207,6 +209,193 @@ test ! -d \$mon_data
|
||||
end
|
||||
end
|
||||
|
||||
context 'Ubuntu 16.04' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '16.04',
|
||||
:service_provider => 'systemd',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with default params' do
|
||||
|
||||
let :title do
|
||||
'A'
|
||||
end
|
||||
|
||||
it {
|
||||
expect {
|
||||
is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running')
|
||||
}.to raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/)
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with key' do
|
||||
|
||||
let :title do
|
||||
'A'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
|
||||
it { is_expected.to contain_exec('create-keyring-A').with(
|
||||
'command' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
cat > /tmp/ceph-mon-keyring-A << EOF
|
||||
[mon.]
|
||||
key = AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==
|
||||
caps mon = "allow *"
|
||||
EOF
|
||||
|
||||
chmod 0444 /tmp/ceph-mon-keyring-A
|
||||
',
|
||||
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=$(ceph-mon --id A --show-config-value mon_data) || exit 1 # if ceph-mon fails then the mon is probably not configured yet
|
||||
test -e $mon_data/done
|
||||
') }
|
||||
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
|
||||
'command' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
touch /etc/ceph/ceph.client.admin.keyring'
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if ceph-mon \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /tmp/ceph-mon-keyring-A ; then
|
||||
touch \$mon_data/done \$mon_data/sysvinit \$mon_data/keyring
|
||||
else
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
fi
|
||||
",
|
||||
'logoutput' => true) }
|
||||
it { is_expected.to contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') }
|
||||
end
|
||||
|
||||
describe 'with keyring' do
|
||||
|
||||
let :title do
|
||||
'A'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:keyring => '/etc/ceph/ceph.mon.keyring',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
|
||||
it { is_expected.to contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
|
||||
'command' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
touch /etc/ceph/ceph.client.admin.keyring'
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if ceph-mon \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /etc/ceph/ceph.mon.keyring ; then
|
||||
touch \$mon_data/done \$mon_data/sysvinit \$mon_data/keyring
|
||||
else
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
fi
|
||||
",
|
||||
'logoutput' => true) }
|
||||
end
|
||||
|
||||
describe 'with custom params' do
|
||||
|
||||
let :title do
|
||||
'A'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:public_addr => '127.0.0.1',
|
||||
:authentication_type => 'none',
|
||||
:cluster => 'testcluster',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'running') }
|
||||
it { is_expected.to contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") }
|
||||
it { is_expected.to contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with(
|
||||
'command' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
touch /etc/ceph/testcluster.client.admin.keyring'
|
||||
) }
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if ceph-mon --cluster testcluster \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /dev/null ; then
|
||||
touch \$mon_data/done \$mon_data/sysvinit \$mon_data/keyring
|
||||
else
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
fi
|
||||
",
|
||||
'logoutput' => true) }
|
||||
end
|
||||
|
||||
describe 'with ensure absent' do
|
||||
|
||||
let :title do
|
||||
'A'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:ensure => 'absent',
|
||||
:public_addr => '127.0.0.1',
|
||||
:authentication_type => 'none',
|
||||
:cluster => 'testcluster',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_service('ceph-mon-A').with('ensure' => 'stopped') }
|
||||
it { is_expected.to contain_exec('remove-mon-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
|
||||
rm -fr \$mon_data
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do
|
||||
mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data)
|
||||
test ! -d \$mon_data
|
||||
",
|
||||
'logoutput' => true) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'RHEL7' do
|
||||
|
||||
let :facts do
|
||||
|
@ -23,7 +23,7 @@ describe 'ceph::rgw' do
|
||||
'include ceph::params'
|
||||
end
|
||||
|
||||
describe 'Debian Family' do
|
||||
describe 'Ubuntu 14.04' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
@ -33,6 +33,7 @@ describe 'ceph::rgw' do
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '14.04',
|
||||
:service_provider => 'upstart',
|
||||
}
|
||||
end
|
||||
|
||||
@ -117,6 +118,99 @@ describe 'ceph::rgw' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Ubuntu 16.04' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
:fqdn => 'myhost.domain',
|
||||
:hostname => 'myhost',
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '16.04',
|
||||
:service_provider => 'systemd',
|
||||
}
|
||||
end
|
||||
|
||||
describe "activated with default params" do
|
||||
|
||||
let :title do
|
||||
'radosgw.gateway'
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('radosgw').with('ensure' => 'installed') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_print_continue').with_value(false) }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.gateway/rgw_socket_path').with_value('/tmp/radosgw.sock') }
|
||||
|
||||
it { is_expected.to contain_file('/var/lib/ceph/radosgw').with({
|
||||
'ensure' => 'directory',
|
||||
'mode' => '0755',
|
||||
})}
|
||||
|
||||
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with({
|
||||
'ensure' => 'directory',
|
||||
'owner' => 'root',
|
||||
'group' => 'root',
|
||||
'mode' => '0750',
|
||||
})}
|
||||
|
||||
it { is_expected.to contain_service('radosgw-radosgw.gateway') }
|
||||
|
||||
end
|
||||
|
||||
describe "activated with custom params" do
|
||||
|
||||
let :title do
|
||||
'radosgw.custom'
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:pkg_radosgw => 'pkgradosgw',
|
||||
:rgw_ensure => 'stopped',
|
||||
:rgw_enable => false,
|
||||
:rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom",
|
||||
:user => 'wwwuser',
|
||||
:keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring",
|
||||
:log_file => '/var/log/ceph/mylogfile.log',
|
||||
:rgw_dns_name => 'mydns.hostname',
|
||||
:rgw_socket_path => '/some/location/radosgw.sock',
|
||||
:rgw_print_continue => true,
|
||||
:rgw_port => 1111,
|
||||
:syslog => false,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('pkgradosgw').with('ensure' => 'installed') }
|
||||
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_print_continue').with_value(true) }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_socket_path').with_value('/some/location/radosgw.sock') }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/rgw_port').with_value(1111) }
|
||||
it { is_expected.to contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
|
||||
|
||||
it { is_expected.to contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( {
|
||||
'ensure' => 'directory',
|
||||
'owner' => 'root',
|
||||
'group' => 'root',
|
||||
'mode' => '0750',
|
||||
} ) }
|
||||
|
||||
it { is_expected.to_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') }
|
||||
|
||||
it { is_expected.to contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe 'RedHat Family' do
|
||||
|
||||
let :facts do
|
||||
|
Loading…
Reference in New Issue
Block a user