diff --git a/Rakefile b/Rakefile index 58bdf266..48f2f958 100644 --- a/Rakefile +++ b/Rakefile @@ -9,4 +9,4 @@ end PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetLint.configuration.send('disable_class_parameter_defaults') \ No newline at end of file diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 00000000..9e4c5a12 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,149 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +# init takes care of installing/configuring the common dependencies across classes +# it also takes care of the global configuration values +### == Parameters +# [*fsid*] The cluster's fsid. +# Mandatory. Get one with `uuidgen -r`. +# +# [*authentication_type*] Authentication type. +# Optional. none or 'cephx'. Defaults to 'cephx'. +# +# [*keyring*] The location of the keyring retrieved by default +# Optional. Defaults to /etc/ceph/keyring. +# +# [*osd_pool_default_pg_num*] The default number of PGs per pool. +# Optional. Integer. Default provided by Ceph. +# +# [*osd_pool_default_pgp_num*] The default flags for new pools. +# Optional. Integer. Default provided by Ceph. +# +# [*$osd_pool_size*] Number of replicas for objects in the pool +# Optional. Integer. Default provided by Ceph. +# +# [*osd_pool_default_min_size*] The default minimum num of replicas. +# Optional. Integer. Default provided by Ceph. +# +# [*osd_default_crush_rule*] The default CRUSH ruleset to use +# when creating a pool. +# Optional. Integer. Default provided by Ceph. +# +# [*mon_osd_full_ratio*] Percentage of disk space used before +# an OSD considered full +# Optional. Integer e.g. 95, NOTE: ends in config as .95 +# Default provided by Ceph. +# +# [*mon_osd_nearfull_ratio*] Percentage of disk space used before +# an OSD considered nearfull +# Optional. Float e.g. 90, NOTE: ends in config as .90 +# Default provided by Ceph. +# +# [*mon_initial_members*] The IDs of initial MONs in the cluster during startup. +# Optional. String like e.g. 'a, b, c'. +# +## [*mon_host*] The fqdn of MONs in the cluster. They can also be declared +# individually through ceph::mon. +# Optional. String like e.g. 'a, b, c'. +# +# [*require_signatures*] If Ceph requires signatures on all +# message traffic (client<->cluster and between cluster daemons). +# Optional. Boolean. Default provided by Ceph. +# +# [*cluster_require_signatures*] If Ceph requires signatures on all +# message traffic between the cluster daemons. +# Optional. Boolean. Default provided by Ceph. +# +# [*service_require_signatures*] If Ceph requires signatures on all +# message traffic between clients and the cluster. +# Optional. Boolean. Default provided by Ceph. +# +# [*sign_messages*] If all ceph messages should be signed. +# Optional. Boolean. Default provided by Ceph. +# +# [*cluster_network*] The address of the cluster network. +# Optional. {cluster-network-ip/netmask} +# +# [*public_network*] The address of the public network. +# Optional. {public-network-ip/netmask} + +class ceph ( + $fsid, + $authentication_type = 'cephx', + $keyring = '/etc/ceph/keyring', + $osd_pool_default_pg_num = undef, + $osd_pool_default_pgp_num = undef, + $osd_pool_default_size = undef, + $osd_pool_default_min_size = undef, + $osd_default_crush_rule = undef, + $mon_osd_full_ratio = undef, + $mon_osd_nearfull_ratio = undef, + $mon_initial_members = undef, + $mon_host = undef, + $require_signatures = undef, + $cluster_require_signatures = undef, + $service_require_signatures = undef, + $sign_messages = undef, + $cluster_network = undef, + $public_network = undef, +) { + include ceph::params + + # Make sure ceph is installed before managing the configuration + Package['ceph'] -> Ceph_Config<| |> + + package { 'ceph': + ensure => present, + name => $::ceph::params::package_name, + } + + # [global] + ceph_config { + 'global/fsid': value => $fsid; + 'global/keyring': value => $keyring; + 'global/osd_pool_default_pg_num': value => $osd_pool_default_pg_num; + 'global/osd_pool_default_pgp_num': value => $osd_pool_default_pgp_num; + 'global/osd_pool_default_size': value => $osd_pool_default_size; + 'global/osd_pool_default_min_size': value => $osd_pool_default_min_size; + 'global/osd_default_crush_rule': value => $osd_default_crush_rule; + 'global/mon_osd_full_ratio': value => $mon_osd_full_ratio; + 'global/mon_osd_nearfull_ratio': value => $mon_osd_nearfull_ratio; + 'global/mon_initial_members': value => $mon_initial_members; + 'global/mon_host': value => $mon_host; + 'global/require_signatures': value => $require_signatures; + 'global/cluster_require_signatures': value => $cluster_require_signatures; + 'global/service_require_signatures': value => $service_require_signatures; + 'global/sign_messages': value => $sign_messages; + 'global/cluster_network': value => $cluster_network; + 'global/public_network': value => $public_network; + } + + if $authentication_type == 'cephx' { + ceph_config { + 'global/auth_cluster_required': value => 'cephx'; + 'global/auth_service_required': value => 'cephx'; + 'global/auth_client_required': value => 'cephx'; + 'global/auth_supported': value => 'cephx'; + } + } else { + ceph_config { + 'global/auth_cluster_required': value => 'none'; + 'global/auth_service_required': value => 'none'; + 'global/auth_client_required': value => 'none'; + 'global/auth_supported': value => 'none'; + } + } +} \ No newline at end of file diff --git a/manifests/mds.pp b/manifests/mds.pp new file mode 100644 index 00000000..c2b6238b --- /dev/null +++ b/manifests/mds.pp @@ -0,0 +1,46 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +# Installs and configures MDSs (ceph metadata servers) +### == Parameters +# [*mds_activate*] Switch to activate the '[mds]' section in the config. +# Optional. Defaults to 'true'. +# +# [*mds_data*] The path to the MDS data. +# Optional. Default provided by Ceph is '/var/lib/ceph/mds/$cluster-$id'. +# +# [*keyring*] The location of the keyring used by MDSs +# Optional. Defaults to /var/lib/ceph/mds/$cluster-$id/keyring. + +class ceph::mds ( + $mds_activate = true, + $mds_data = '/var/lib/ceph/mds/$cluster-$id', + $keyring = '/var/lib/ceph/mds/$cluster-$id/keyring', +) { + + # [mds] + if $mds_activate { + ceph_config { + 'mds/mds_data': value => $mds_data; + 'mds/keyring': value => $keyring; + } + } else { + ceph_config { + 'mds/mds_data': ensure => absent; + 'mds/keyring': ensure => absent; + } + } +} \ No newline at end of file diff --git a/manifests/mon.pp b/manifests/mon.pp new file mode 100644 index 00000000..8a34fcc6 --- /dev/null +++ b/manifests/mon.pp @@ -0,0 +1,35 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +# Installs and configures MONs (ceph monitors) +### == Parameters +# [*mon_data*] The monitor’s data location. +# Optional. Default provided by Ceph is '/var/lib/ceph/mon/$cluster-$id'. +# +# [*keyring*] The location of the keyring used by MONs +# Optional. Defaults to '/var/lib/ceph/mon/$cluster-$id/keyring'. + +class ceph::mon ( + $mon_data = '/var/lib/ceph/mon/$cluster-$id', + $keyring = '/var/lib/ceph/mon/$cluster-$id/keyring', +) { + + # [mon] + ceph_config { + 'mon/mon_data': value => $mon_data; + 'mon/keyring': value => $keyring; + } +} \ No newline at end of file diff --git a/manifests/osd.pp b/manifests/osd.pp new file mode 100644 index 00000000..3cb16e4a --- /dev/null +++ b/manifests/osd.pp @@ -0,0 +1,66 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +# Installs and configures OSDs (ceph object storage daemons) +### == Parameters +# [*osd_data*] The OSDs data location. +# Optional. Defaults provided by ceph is '/var/lib/ceph/osd/$cluster-$id'. +# +# [*osd_journal*] The path to the OSD’s journal. +# Optional. Absolute path. Defaults to '/var/lib/ceph/osd/$cluster-$id/journal' +# +# [*osd_journal_size*] The size of the journal in megabytes. +# Optional. Default provided by Ceph. +# +# [*keyring*] The location of the keyring used by OSDs +# Optional. Defaults to '/var/lib/ceph/osd/$cluster-$id/keyring' +# +# [*filestore_flusher*] Allows to enable the filestore flusher. +# Optional. Default provided by Ceph. +# +# [*osd_mkfs_type*] Type of the OSD filesystem. +# Optional. Defaults to 'xfs'. +# +# [*osd_mkfs_options*] The options used to format the OSD fs. +# Optional. Defaults to '-f' for XFS. +# +# [*osd_mount_options*] The options used to mount the OSD fs. +# Optional. Defaults to 'rw,noatime,inode64,nobootwait' for XFS. +# + +class ceph::osd ( + $osd_data = '/var/lib/ceph/osd/$cluster-$id', + $osd_journal = '/var/lib/ceph/osd/$cluster-$id/journal', + $osd_journal_size = undef, + $keyring = '/var/lib/ceph/osd/$cluster-$id/keyring', + $filestore_flusher = undef, + $osd_mkfs_type = 'xfs', + $osd_mkfs_options = '-f', + $osd_mount_options = 'rw,noatime,inode64,nobootwait', +) { + + # [osd] + ceph_config { + 'osd/osd_data': value => $osd_data; + 'osd/osd_journal': value => $osd_journal; + 'osd/osd_journal_size': value => $osd_journal_size; + 'osd/keyring': value => $keyring; + 'osd/filestore_flusher': value => $filestore_flusher; + 'osd/osd_mkfs_type': value => $osd_mkfs_type; + 'osd/osd_mkfs_options': value => $osd_mkfs_options; + 'osd/osd_mount_options': value => $osd_mount_options; + } +} \ No newline at end of file diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 00000000..86e5afe9 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,33 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +# these parameters need to be accessed from several locations and +# should be considered to be constant + +class ceph::params { + + $package_name = 'ceph' + + case $::osfamily { + 'Debian': { + # Nothing here yet + } + + default: { + fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only supports osfamily Debian") + } + } +} \ No newline at end of file diff --git a/spec/classes/ceph_init_spec.rb b/spec/classes/ceph_init_spec.rb new file mode 100644 index 00000000..67ea129c --- /dev/null +++ b/spec/classes/ceph_init_spec.rb @@ -0,0 +1,121 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +require 'spec_helper' + +describe 'ceph' do + + describe 'Debian Family' do + let :facts do + { + :osfamily => 'Debian', + } + end + + describe "with default params and specified fsid" do + let :params do + { + :fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b', + } + end + + it { should contain_package('ceph').with( + 'name' => 'ceph', + 'ensure' => 'present') } + + it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') } + it { should contain_ceph_config('global/keyring').with_value('/etc/ceph/keyring') } + it { should_not contain_ceph_config('global/osd_pool_default_pg_num').with_value('128') } + it { should_not contain_ceph_config('global/osd_pool_default_pgp_num').with_value('128') } + it { should_not contain_ceph_config('global/osd_pool_default_size').with_value('3') } + it { should_not contain_ceph_config('global/osd_pool_default_min_size').with_value('2') } + it { should_not contain_ceph_config('global/osd_default_crush_rule').with_value('0') } + it { should_not contain_ceph_config('global/mon_osd_full_ratio').with_value('90') } + it { should_not contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('85') } + it { should_not contain_ceph_config('global/mon_initial_members').with_value('mon.01') } + it { should_not contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') } + it { should_not contain_ceph_config('global/require_signatures').with_value('false') } + it { should_not contain_ceph_config('global/cluster_require_signatures').with_value('false') } + it { should_not contain_ceph_config('global/service_require_signatures').with_value('false') } + it { should_not contain_ceph_config('global/sign_messages').with_value('true') } + it { should_not contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') } + it { should_not contain_ceph_config('global/public_network').with_value('192.168.0.0/24') } + it { should contain_ceph_config('global/auth_cluster_required').with_value('cephx') } + it { should contain_ceph_config('global/auth_service_required').with_value('cephx') } + it { should contain_ceph_config('global/auth_client_required').with_value('cephx') } + it { should contain_ceph_config('global/auth_supported').with_value('cephx') } + it { should_not contain_ceph_config('global/auth_cluster_required').with_value('none') } + it { should_not contain_ceph_config('global/auth_service_required').with_value('none') } + it { should_not contain_ceph_config('global/auth_client_required').with_value('none') } + it { should_not contain_ceph_config('global/auth_supported').with_value('none') } + end + + describe "with custom params and specified fsid" do + let :params do + { + :fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b', + :authentication_type => 'none', + :keyring => '/usr/local/ceph/etc/keyring', + :osd_pool_default_pg_num => '256', + :osd_pool_default_pgp_num => '256', + :osd_pool_default_size => '2', + :osd_pool_default_min_size => '1', + :osd_default_crush_rule => '10', + :mon_osd_full_ratio => '95', + :mon_osd_nearfull_ratio => '90', + :mon_initial_members => 'mon.01', + :mon_host => 'mon01.ceph, mon02.ceph', + :require_signatures => 'true', + :cluster_require_signatures => 'true', + :service_require_signatures => 'true', + :sign_messages => 'false', + :cluster_network => '10.0.0.0/24', + :public_network => '192.168.0.0/24', + } + end + + it { should contain_package('ceph').with( + 'name' => 'ceph', + 'ensure' => 'present') } + + it { should contain_ceph_config('global/fsid').with_value('d5252e7d-75bc-4083-85ed-fe51fa83f62b') } + it { should contain_ceph_config('global/keyring').with_value('/usr/local/ceph/etc/keyring') } + it { should contain_ceph_config('global/osd_pool_default_pg_num').with_value('256') } + it { should contain_ceph_config('global/osd_pool_default_pgp_num').with_value('256') } + it { should contain_ceph_config('global/osd_pool_default_size').with_value('2') } + it { should contain_ceph_config('global/osd_pool_default_min_size').with_value('1') } + it { should contain_ceph_config('global/osd_default_crush_rule').with_value('10') } + it { should contain_ceph_config('global/mon_osd_full_ratio').with_value('95') } + it { should contain_ceph_config('global/mon_osd_nearfull_ratio').with_value('90') } + it { should contain_ceph_config('global/mon_initial_members').with_value('mon.01') } + it { should contain_ceph_config('global/mon_host').with_value('mon01.ceph, mon02.ceph') } + it { should contain_ceph_config('global/require_signatures').with_value('true') } + it { should contain_ceph_config('global/cluster_require_signatures').with_value('true') } + it { should contain_ceph_config('global/service_require_signatures').with_value('true') } + it { should contain_ceph_config('global/sign_messages').with_value('false') } + it { should contain_ceph_config('global/cluster_network').with_value('10.0.0.0/24') } + it { should contain_ceph_config('global/public_network').with_value('192.168.0.0/24') } + it { should_not contain_ceph_config('global/auth_cluster_required').with_value('cephx') } + it { should_not contain_ceph_config('global/auth_service_required').with_value('cephx') } + it { should_not contain_ceph_config('global/auth_client_required').with_value('cephx') } + it { should_not contain_ceph_config('global/auth_supported').with_value('cephx') } + it { should contain_ceph_config('global/auth_cluster_required').with_value('none') } + it { should contain_ceph_config('global/auth_service_required').with_value('none') } + it { should contain_ceph_config('global/auth_client_required').with_value('none') } + it { should contain_ceph_config('global/auth_supported').with_value('none') } + end + end +end \ No newline at end of file diff --git a/spec/classes/ceph_mds_spec.rb b/spec/classes/ceph_mds_spec.rb new file mode 100644 index 00000000..28d2f271 --- /dev/null +++ b/spec/classes/ceph_mds_spec.rb @@ -0,0 +1,62 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +require 'spec_helper' + +describe 'ceph::mds' do + + describe 'Debian Family' do + let :facts do + { + :osfamily => 'Debian', + } + end + + describe "activated with default params" do + + it { should contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/$cluster-$id') } + it { should contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/$cluster-$id/keyring') } + + end + + describe "activated with custom params" do + let :params do + { + :mds_data => '/usr/local/ceph/var/lib/mds/_cluster-_id', + :keyring => '/usr/local/ceph/var/lib/mds/_cluster-_id/keyring' + } + end + + it { should contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') } + it { should contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') } + + end + + describe "not activated" do + let :params do + { + :mds_activate => false + } + end + + it { should_not contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/_cluster-_id') } + it { should_not contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/_cluster-_id/keyring') } + it { should contain_ceph_config('mds/mds_data').with_ensure('absent') } + it { should contain_ceph_config('mds/keyring').with_ensure('absent') } + + end + end +end \ No newline at end of file diff --git a/spec/classes/ceph_mon_spec.rb b/spec/classes/ceph_mon_spec.rb new file mode 100644 index 00000000..00ba7332 --- /dev/null +++ b/spec/classes/ceph_mon_spec.rb @@ -0,0 +1,48 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +require 'spec_helper' + +describe 'ceph::mon' do + + describe 'Debian Family' do + let :facts do + { + :osfamily => 'Debian', + } + end + + describe "with default params" do + + it { should contain_ceph_config('mon/mon_data').with_value('/var/lib/ceph/mon/$cluster-$id') } + it { should contain_ceph_config('mon/keyring').with_value('/var/lib/ceph/mon/$cluster-$id/keyring') } + + end + + describe "with custom params" do + let :params do + { + :mon_data => '/usr/local/ceph/var/lib/mon/mon._id', + :keyring => '/usr/local/ceph/var/lib/mon/mon._id/keyring', + } + end + + it { should_not contain_ceph_config('mon/mon_data').with_value('/var/lib/ceph/mon/_cluster-_id') } + it { should_not contain_ceph_config('mon/keyring').with_value('/var/lib/ceph/mon/_cluster-_id/keyring') } + + end + end +end \ No newline at end of file diff --git a/spec/classes/ceph_osd_spec.rb b/spec/classes/ceph_osd_spec.rb new file mode 100644 index 00000000..999a08be --- /dev/null +++ b/spec/classes/ceph_osd_spec.rb @@ -0,0 +1,66 @@ +# Copyright (C) iWeb Technologies Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author: David Moreau Simard + +require 'spec_helper' + +describe 'ceph::osd' do + + describe 'Debian Family' do + let :facts do + { + :osfamily => 'Debian', + } + end + + describe "with default params" do + + it { should contain_ceph_config('osd/osd_data').with_value('/var/lib/ceph/osd/$cluster-$id') } + it { should contain_ceph_config('osd/osd_journal').with_value('/var/lib/ceph/osd/$cluster-$id/journal') } + it { should_not contain_ceph_config('osd/osd_journal_size').with_value('2048') } + it { should contain_ceph_config('osd/keyring').with_value('/var/lib/ceph/osd/$cluster-$id/keyring') } + it { should_not contain_ceph_config('osd/filestore_flusher').with_value('true') } + it { should contain_ceph_config('osd/osd_mkfs_type').with_value('xfs') } + it { should contain_ceph_config('osd/osd_mkfs_options').with_value('-f') } + it { should contain_ceph_config('osd/osd_mount_options').with_value('rw,noatime,inode64,nobootwait') } + + end + + describe "with custom params" do + let :params do + { + :osd_data => '/usr/local/ceph/var/lib/osd/_cluster-_id', + :osd_journal => '/usr/local/ceph/var/lib/osd/_cluster-_id/journal', + :osd_journal_size => '2048', + :keyring => '/usr/local/ceph/var/lib/osd/_cluster-_id/keyring', + :filestore_flusher => 'true', + :osd_mkfs_type => 'ext4', + :osd_mkfs_options => '-V', + :osd_mount_options => 'defaults', + } + end + + it { should contain_ceph_config('osd/osd_data').with_value('/usr/local/ceph/var/lib/osd/_cluster-_id') } + it { should contain_ceph_config('osd/osd_journal').with_value('/usr/local/ceph/var/lib/osd/_cluster-_id/journal') } + it { should contain_ceph_config('osd/osd_journal_size').with_value('2048') } + it { should contain_ceph_config('osd/keyring').with_value('/usr/local/ceph/var/lib/osd/_cluster-_id/keyring') } + it { should contain_ceph_config('osd/filestore_flusher').with_value('true') } + it { should contain_ceph_config('osd/osd_mkfs_type').with_value('ext4') } + it { should contain_ceph_config('osd/osd_mkfs_options').with_value('-V') } + it { should contain_ceph_config('osd/osd_mount_options').with_value('defaults') } + + end + end +end \ No newline at end of file