File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Class: datadog_agent::integrations::ceph
2+ #
3+ # This class will install the necessary configuration for the ceph integration
4+ #
5+ # Parameters:
6+
7+ # Sample Usage:
8+ #
9+ # class { 'datadog_agent::integrations::ceph' :
10+ # }
11+ #
12+ class datadog_agent::integrations::ceph (
13+ ) inherits datadog_agent::params {
14+ include datadog_agent
15+
16+ file { '/etc/sudoers.d/datadog_ceph' :
17+ content => " # This file is required for dd ceph \n dd-agent ALL=(ALL) NOPASSWD:/usr/bin/ceph\n "
18+ }
19+
20+ file { "${datadog_agent::params::conf_dir}/ceph.yaml" :
21+ ensure => file ,
22+ owner => $datadog_agent::params::dd_user ,
23+ group => $datadog_agent::params::dd_group ,
24+ mode => ' 0600' ,
25+ content => template (' datadog_agent/agent-conf.d/ceph.yaml.erb' ),
26+ require => Package[$datadog_agent::params::package_name ],
27+ notify => Service[$datadog_agent::params::service_name ]
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'datadog_agent::integrations::ceph' do
4+ let ( :facts ) { {
5+ operatingsystem : 'Ubuntu' ,
6+ } }
7+ let ( :conf_dir ) { '/etc/dd-agent/conf.d' }
8+ let ( :dd_user ) { 'dd-agent' }
9+ let ( :dd_group ) { 'root' }
10+ let ( :dd_package ) { 'datadog-agent' }
11+ let ( :dd_service ) { 'datadog-agent' }
12+ let ( :conf_file ) { "#{ conf_dir } /ceph.yaml" }
13+ let ( :sudo_conf_file ) { '/etc/sudoers.d/datadog_ceph' }
14+
15+ it { should compile . with_all_deps }
16+ it { should contain_file ( conf_file ) . with (
17+ owner : dd_user ,
18+ group : dd_group ,
19+ mode : '0600' ,
20+ ) }
21+ it { should contain_file ( conf_file ) . that_requires ( "Package[#{ dd_package } ]" ) }
22+ it { should contain_file ( conf_file ) . that_notifies ( "Service[#{ dd_service } ]" ) }
23+
24+ context 'with default parameters' do
25+ it { should contain_file ( conf_file ) . with_content ( /tags:\s +- name:ceph_cluster\s *?[^-]/m ) }
26+ it { should contain_file ( conf_file ) . with_content ( /^\s *ceph_cmd:\s *\/ usr\/ bin\/ ceph\s *?[^-]/m ) }
27+ it { should contain_file ( conf_file ) . with_content ( /^\s *use_sudo:\s True$/ ) }
28+ it { should contain_file ( sudo_conf_file ) . with_content ( /^dd-agent\s ALL=.*NOPASSWD:\/ usr\/ bin\/ ceph$/ ) }
29+ end
30+
31+ end
Original file line number Diff line number Diff line change 1+ init_config:
2+
3+ instances:
4+ - tags:
5+ - name:ceph_cluster
6+
7+ ceph_cmd: /usr/bin/ceph
8+
9+ # If your environment requires sudo, please add a line like:
10+ # dd-agent ALL=(ALL) NOPASSWD:/usr/bin/ceph
11+ # to your sudoers file, and uncomment the below option.
12+
13+ use_sudo: True
You can’t perform that action at this time.
0 commit comments