diff --git a/data/common.yaml b/data/common.yaml index c335208..c71fc64 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -1,7 +1,7 @@ --- splunk::group: 'splunk' splunk::user: 'splunk' -splunk::type: 'none' +splunk::type: 'forwarder' splunk::admin_pass: 'changeme' splunk::adhoc_searchhead: false splunk::autolb: true diff --git a/manifests/acl.pp b/manifests/acl.pp index 51cd0b3..bff704a 100644 --- a/manifests/acl.pp +++ b/manifests/acl.pp @@ -57,6 +57,7 @@ exec { "set_acl_${object}": command => "setfacl -m ${acl} ${object}", onlyif => $testacl, + unless => "getfacl ${object} 2>/dev/null | grep -q '${acl}'", path => '/bin:/usr/bin:/sbin:/usr/sbin', } @@ -64,6 +65,7 @@ exec { "set_acl_recursive_${object}": command => "setfacl -R -m ${acl} ${object}", onlyif => $testacl, + unless => "getfacl ${object} 2>/dev/null | grep -q '${acl}'", path => '/bin:/usr/bin:/sbin:/usr/sbin', } } diff --git a/manifests/fetch.pp b/manifests/fetch.pp index a56dcce..38f96b3 100644 --- a/manifests/fetch.pp +++ b/manifests/fetch.pp @@ -20,6 +20,7 @@ $source = $splunk::source $sourcepart = $splunk::sourcepart $type = $splunk::type + $product = $splunk::product $version = $splunk::version $release = $splunk::release $newsource = $splunk::newsource @@ -29,34 +30,10 @@ $version_parts = split($version, '\.') $major = $version_parts[0] $minor = pick($version_parts, 1, '0') - $is_new_naming = versioncmp("${major}.${minor}.0", '9.4.0') >= 0 - if $is_new_naming { - $pkg_kernel = 'linux' - $pkg_arch = $facts['os']['architecture'] ? { - 'x86_64' => 'amd64', - 'amd64' => 'amd64', - default => 'amd64' - } - $pkg_platform = "${pkg_kernel}-${pkg_arch}" - } else { - $pkg_kernel = $facts['kernel'] - $pkg_arch = $facts['os']['architecture'] ? { - 'x86_64' => 'x86_64', - 'amd64' => 'x86_64', - default => 'i686' - } - $pkg_platform = "${pkg_kernel}-${pkg_arch}" - } - - if $type == 'forwarder' { - $product = 'universalforwarder' - } else { - $product = 'splunk' - } if $source == 'splunk' or $source =~ /http.*/ { if $source == 'splunk' { - $wget_url = "https://download.splunk.com/products/${product}/releases/${version}/linux/${sourcepart}-${version}-${release}-${pkg_platform}.tgz" + $wget_url = "https://download.splunk.com/products/${product}/releases/${version}/linux/${newsource}" } else { $wget_url = "${source}/${newsource}" } diff --git a/manifests/init.pp b/manifests/init.pp index 722f906..1e7e693 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -271,8 +271,10 @@ if $type == 'forwarder' { $sourcepart = 'splunkforwarder' + $product = 'universalforwarder' } else { $sourcepart = 'splunk' + $product = 'splunk' } # Use computed platform token when building package filename diff --git a/metadata.json b/metadata.json index 8e71be1..13b9224 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "cudgel-splunk", - "version": "2.3.4", + "version": "2.3.5", "author": "Christopher Caldwell", "summary": "Deploy and manage stand-alone or distributed Splunk architectures.", "license": "Apache-2.0", diff --git a/spec/classes/splunk_spec.rb b/spec/classes/splunk_spec.rb index b75b120..c7fe9fa 100644 --- a/spec/classes/splunk_spec.rb +++ b/spec/classes/splunk_spec.rb @@ -52,7 +52,7 @@ it { is_expected.to contain_file('/home/splunk/.bashrc.custom') } it { is_expected.to contain_class('splunk::fetch') } it { is_expected.to contain_exec('retrieve_splunkforwarder-9.4.4-f627d88b766b-linux-amd64.tgz') } - it { is_expected.to contain_notify('wget_command') } + it { is_expected.to contain_notify('wget_command').with_message(%r{universalforwarder}) } it { is_expected.to contain_class('splunk::install') } it { is_expected.to contain_file('/opt/splunkforwarder-9.4.4-f627d88b766b-linux-amd64.tgz').that_notifies('Exec[unpackSplunk]') } it { is_expected.to contain_class('splunk::config') }