From e21b53cb385702f30d6c49e607fd4e96ef382dde Mon Sep 17 00:00:00 2001 From: tragiccode <6224270+TraGicCode@users.noreply.github.com> Date: Tue, 3 Oct 2017 16:36:10 -0500 Subject: [PATCH 1/5] Updated code to start using the *new* download path being followed by download.splunk.com --- README.md | 54 ++++++++++++++++++------------- manifests/params.pp | 79 ++++++++++++++++++++++++++------------------- 2 files changed, 76 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index f9d7732b..efd996dc 100644 --- a/README.md +++ b/README.md @@ -70,32 +70,40 @@ The files must be placed according to directory structure example given below. The expected directory structure is: - `-- files - |-- splunk - | `-- $platform - | `-- splunk-${version}-${build}-${additl} - `-- universalforwarder - `-- $platform - `-- splunkforwarder-${version}-${build}-${additl} + $root_url/ + └── products/ + ├── universalforwarder/ + │ └── releases/ + | └── $version/ + | └── $platform/ + | └── splunkforwarder-${version}-${build}-${additl} + └── splunk/ + └── releases/ + └── $version/ + └── $platform/ + └── splunk-${version}-${build}-${additl} A semi-populated example files directory might then contain: - `-- files - |-- splunk - | `-- linux - | |-- splunk-6.3.3-f44afce176d0-linux-2.6-amd64.deb - | |-- splunk-6.3.3-f44afce176d0-linux-2.6-intel.deb - | `-- splunk-6.3.3-f44afce176d0-linux-2.6-x86_64.rpm - `-- universalforwarder - |-- linux - | |-- splunkforwarder-6.3.3-f44afce176d0-linux-2.6-amd64.deb - | |-- splunkforwarder-6.3.3-f44afce176d0-linux-2.6-intel.deb - | `-- splunkforwarder-6.3.3-f44afce176d0-linux-2.6-x86_64.rpm - |-- solaris - | `-- splunkforwarder-6.3.3-f44afce176d0-solaris-9-intel.pkg - `-- windows - |-- splunkforwarder-6.3.3-f44afce176d0-x64-release.msi - `-- splunkforwarder-6.3.3-f44afce176d0-x86-release.msi + $root_url/ + └── products/ + ├── universalforwarder/ + │ └── releases/ + | └── 7.0.0/ + | ├── linux/ + | | ├── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-amd64.deb + | | ├── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-intel.deb + | | └── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-x86_64.rpm + | ├── solaris/ + | └── windows/ + | └── splunkforwarder-7.0.0-c8a78efdd40f-x64-release.msi + └── splunk/ + └── releases/ + └── 7.0.0/ + └── linux/ + ├── splunk-7.0.0-c8a78efdd40f-linux-2.6-amd64.deb + ├── splunk-7.0.0-c8a78efdd40f-linux-2.6-intel.deb + └── splunk-7.0.0-c8a78efdd40f-linux-2.6-x86_64.rpm Second, you will need to supply the `splunk::params` class with three critical pieces of information. diff --git a/manifests/params.pp b/manifests/params.pp index 7fb12919..5d47d5f8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -33,32 +33,43 @@ # the puppet/archive module supports. This includes both puppet:// and # http://. The expected directory structure is: # -# `-- $root_url -# |-- splunk -# | `-- $platform -# | `-- splunk-${version}-${build}-${additl} -# `-- universalforwarder -# `-- $platform -# `-- splunkforwarder-${version}-${build}-${additl} +# +# $root_url/ +# └── products/ +# ├── universalforwarder/ +# │ └── releases/ +# | └── $version/ +# | └── $platform/ +# | └── splunkforwarder-${version}-${build}-${additl} +# └── splunk/ +# └── releases/ +# └── $version/ +# └── $platform/ +# └── splunk-${version}-${build}-${additl} +# # # A semi-populated example src_root then contain: # -# `-- $root_url -# |-- splunk -# | `-- linux -# | |-- splunk-4.3.2-123586-linux-2.6-amd64.deb -# | |-- splunk-4.3.2-123586-linux-2.6-intel.deb -# | `-- splunk-4.3.2-123586-linux-2.6-x86_64.rpm -# `-- universalforwarder -# |-- linux -# | |-- splunkforwarder-4.3.2-123586-linux-2.6-amd64.deb -# | |-- splunkforwarder-4.3.2-123586-linux-2.6-intel.deb -# | `-- splunkforwarder-4.3.2-123586-linux-2.6-x86_64.rpm -# |-- solaris -# | `-- splunkforwarder-4.3.2-123586-solaris-10-intel.pkg -# `-- windows -# |-- splunkforwarder-4.3.2-123586-x64-release.msi -# `-- splunkforwarder-4.3.2-123586-x86-release.msi +# $root_url/ +# └── products/ +# ├── universalforwarder/ +# │ └── releases/ +# | └── 7.0.0/ +# | ├── linux/ +# | | ├── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-amd64.deb +# | | ├── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-intel.deb +# | | └── splunkforwarder-7.0.0-c8a78efdd40f-linux-2.6-x86_64.rpm +# | ├── solaris/ +# | └── windows/ +# | └── splunkforwarder-7.0.0-c8a78efdd40f-x64-release.msi +# └── splunk/ +# └── releases/ +# └── 7.0.0/ +# └── linux/ +# ├── splunk-7.0.0-c8a78efdd40f-linux-2.6-amd64.deb +# ├── splunk-7.0.0-c8a78efdd40f-linux-2.6-intel.deb +# └── splunk-7.0.0-c8a78efdd40f-linux-2.6-x86_64.rpm +# # # Actions: # @@ -67,9 +78,9 @@ # Requires: nothing # class splunk::params ( - $version = '6.3.3', - $build = 'f44afce176d0', - $src_root = 'puppet:///modules/splunk', + $version = '7.0.0', + $build = 'c8a78efdd40f', + $src_root = 'https://download.splunk.com', $splunkd_port = '8089', $logging_port = '9997', $server = 'splunk', @@ -101,36 +112,36 @@ case $::kernel { 'Linux': { $path_delimiter = '/' - $forwarder_src_subdir = 'universalforwarder/linux' + $forwarder_src_subdir = 'linux' $forwarder_service = [ 'splunk' ] $password_config_file = "${forwarder_dir}/etc/passwd" $secret_file = "${forwarder_dir}/etc/splunk.secret" $forwarder_confdir = "${forwarder_dir}/etc" - $server_src_subdir = 'splunk/linux' + $server_src_subdir = 'linux' $server_service = [ 'splunk', 'splunkd', 'splunkweb' ] $server_confdir = "${server_dir}/etc" $forwarder_install_options = undef } 'SunOS': { $path_delimiter = '/' - $forwarder_src_subdir = 'universalforwarder/solaris' + $forwarder_src_subdir = 'solaris' $forwarder_service = [ 'splunk' ] $password_config_file = "${forwarder_dir}/etc/passwd" $secret_file = "${forwarder_dir}/etc/splunk.secret" $forwarder_confdir = "${forwarder_dir}/etc" - $server_src_subdir = 'splunk/solaris' + $server_src_subdir = 'solaris' $server_service = [ 'splunk', 'splunkd', 'splunkweb' ] $server_confdir = "${server_dir}/etc" $forwarder_install_options = undef } 'Windows': { $path_delimiter = '\\' - $forwarder_src_subdir = 'universalforwarder/windows' + $forwarder_src_subdir = 'windows' $password_config_file = 'C:/Program Files/SplunkUniversalForwarder/etc/passwd' $secret_file = 'C:/Program Files/SplunkUniversalForwarder/etc/splunk.secret' $forwarder_service = [ 'SplunkForwarder' ] # UNKNOWN $forwarder_confdir = "${forwarder_dir}/etc" - $server_src_subdir = 'splunk/windows' + $server_src_subdir = 'windows' $server_service = [ 'Splunkd', 'SplunkWeb' ] # UNKNOWN $server_confdir = "${server_dir}/etc" $forwarder_install_options = [ @@ -237,8 +248,8 @@ $server_src_pkg = "splunk-${package_suffix}" $server_pkg_ensure = 'installed' - $server_pkg_src = "${src_root}/${server_src_subdir}/${server_src_pkg}" - $forwarder_pkg_src = "${src_root}/${forwarder_src_subdir}/${forwarder_src_pkg}" + $server_pkg_src = "${src_root}/products/splunk/releases/${version}/${server_src_subdir}/${server_src_pkg}" + $forwarder_pkg_src = "${src_root}/products/universalforwarder/releases/${version}/${forwarder_src_subdir}/${forwarder_src_pkg}" $create_password = true $forwarder_pkg_ensure = 'installed' From f1d8ca1087b6b6b2536f8d7a29906239fe970570 Mon Sep 17 00:00:00 2001 From: tragiccode <6224270+TraGicCode@users.noreply.github.com> Date: Tue, 3 Oct 2017 16:37:56 -0500 Subject: [PATCH 2/5] Add docker nodesets we want to run under travis-ci --- .sync.yml | 7 +++++++ .travis.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/.sync.yml b/.sync.yml index 4c67d53f..43c11bfc 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,6 +1,13 @@ --- .travis.yml: secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k=" + docker_sets: + - set: docker/centos-6 + - set: docker/centos-7 + - set: docker/debian-7 + - set: docker/debian-8 + - set: docker/ubuntu-14.04 + - set: docker/ubuntu-16.04 spec/spec_helper.rb: spec_overrides: - "require 'splunk_data.rb'" diff --git a/.travis.yml b/.travis.yml index fe9c9d19..d3a76e5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,42 @@ script: matrix: fast_finish: true include: + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-6 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-7 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 CHECK=beaker + services: docker + sudo: required + - rvm: 2.4.1 + bundler_args: --without development + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 CHECK=beaker + services: docker + sudo: required - rvm: 2.1.9 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test From af3c0815754b653bcbdf0f4b6bd7d2934584e103 Mon Sep 17 00:00:00 2001 From: tragiccode <6224270+TraGicCode@users.noreply.github.com> Date: Tue, 3 Oct 2017 16:39:11 -0500 Subject: [PATCH 3/5] Add code to actually allow this module to work properly while inside a docker container ( both for travis-ci and users who want to prebuild docker containers with splunk installed ). --- manifests/init.pp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 7b6d8a17..440524fc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -103,6 +103,21 @@ tag => 'splunk_server', } + if $facts['virtual'] == 'docker' { + ini_setting { 'OPTIMISTIC_ABOUT_FILE_LOCKING': + ensure => present, + section => '', + setting => 'OPTIMISTIC_ABOUT_FILE_LOCKING', + value => '1', + path => '/opt/splunk/etc/splunk-launch.conf', + } + + Package[$package_name] + -> Ini_setting['OPTIMISTIC_ABOUT_FILE_LOCKING'] + -> Exec <| tag == 'splunk_server' |> + } + + splunk_input { 'default_host': section => 'default', setting => 'host', From e3d9b6ebda61d12660c970678a937e878ef0ab4b Mon Sep 17 00:00:00 2001 From: tragiccode <6224270+TraGicCode@users.noreply.github.com> Date: Tue, 3 Oct 2017 16:40:12 -0500 Subject: [PATCH 4/5] Since there is a bug where splunk doesn't uninstall cleanly currently i need to force the forwarder to listen on a different port. This prevents splunk server and splunk forwarder ( which is being run on the same machine ) from fightining over ports. --- spec/acceptance/splunk_forwarder_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/acceptance/splunk_forwarder_spec.rb b/spec/acceptance/splunk_forwarder_spec.rb index 11a48c9e..bc366fb5 100644 --- a/spec/acceptance/splunk_forwarder_spec.rb +++ b/spec/acceptance/splunk_forwarder_spec.rb @@ -5,7 +5,11 @@ # Using puppet_apply as a helper it 'works idempotently with no errors' do pp = <<-EOS - class { '::splunk::forwarder': } + class { '::splunk::params': + } + class { '::splunk::forwarder': + splunkd_port => 8090, + } EOS # Run it twice and test for idempotency From a93301466f40ee207e2857de8215553870c282fd Mon Sep 17 00:00:00 2001 From: tragiccode <6224270+TraGicCode@users.noreply.github.com> Date: Tue, 3 Oct 2017 16:40:47 -0500 Subject: [PATCH 5/5] Fix a bug in the forwarder where it is not actually idempotent. This is also needed to get the idempotence checks to not fail on travis-ci. --- manifests/forwarder.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/forwarder.pp b/manifests/forwarder.pp index a2abc678..fc4ab791 100644 --- a/manifests/forwarder.pp +++ b/manifests/forwarder.pp @@ -170,7 +170,7 @@ group => $splunk_user, mode => $facts['kernel'] ? { 'windows' => undef, - default => '0644', + default => '0600', } }