This module provides a method to deploy Splunk Enterprise or Splunk Universal Forwarder with common configurations and ensure the services maintain a running state. It provides types/providers to interact with the various Splunk/Forwarder configuration files.
This module does not configure firewall rules. Firewall rules will need to be configured separately in order to allow for correct operation of Splunk and the Splunk Universal Forwarder.
To begin using this module, use the Puppet Module Tool (PMT) from the command line to install this module:
puppet module install puppet-splunk
This will place the module into your primary module path if you do not utilize the --target-dir directive.
You can also use r10k or code-manager to deploy the module so ensure that you have the correct entry in your Puppetfile.
By default, this module will download the installation packages from https://download.splunk.com
.
You can also configure offline installers, there is just a little setup needed.
First, you will need to place your downloaded splunk installers into the files
directory, <module_path>/splunk/files/
. If you're using r10k or code-manager
you'll need to override the splunk::params::src_root
parameter to point at a
modulepath outside of the Splunk module because each deploy will overwrite the
files.
The files must be placed according to directory structure example given below.
The expected directory structure is:
$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:
$root_url/
└── products/
├── universalforwarder/
│ └── releases/
| └── 9.2.0/
| ├── linux/
| | ├── splunkforwarder-9.2.0-1fff88043d5f-linux-2.6-amd64.deb
| | ├── splunkforwarder-9.2.0-1fff88043d5f-linux-2.6-intel.deb
| | └── splunkforwarder-9.2.0-1fff88043d5f.x86_64.rpm
| ├── solaris/
| └── windows/
| └── splunkforwarder-9.2.0-1fff88043d5f-x64-release.msi
└── splunk/
└── releases/
└── 9.2.0/
└── linux/
├── splunk-9.2.0-1fff88043d5f-linux-2.6-amd64.deb
├── splunk-9.2.0-1fff88043d5f-linux-2.6-intel.deb
└── splunk-9.2.0-1fff88043d5f.x86_64.rpm
Second, you will need to supply the splunk::params
class with three critical
pieces of information.
In the example given above, the version is 9.2.0, the build is 1fff88043d5f, and the root URL is puppet:///modules/splunk. See the splunk::params class documentation for more information.
Once the Splunk packages are hosted in the users repository or hosted by the Puppet Server in the modulepath the module is ready to deploy.
If a user is installing Splunk Enterprise with packages provided from their modulepath, this is the most basic way of installing Splunk Server with default settings:
include splunk::enterprise
This is the most basic way of installing the Splunk Universal Forwarder with default settings:
class { 'splunk::params':
server => $my_splunk_server,
}
include splunk::forwarder
Once both Splunk Enterprise and Splunk Universal Forwarder have been deployed on their respective nodes, the Forwarder is ready to start sending logs.
In order to start sending some log data, users can take advantage of the
Splunkforwarder_input
type. Here is a basic example of adding an input to
start sending Puppet Server logs:
@splunkforwarder_input { 'puppetserver-sourcetype':
section => 'monitor:///var/log/puppetlabs/puppetserver/puppetserver.log',
setting => 'sourcetype',
value => 'puppetserver',
tag => 'splunk_forwarder'
}
This virtual resource will get collected by the ::splunk::forwarder
class if
it is tagged with splunk_forwarder
and will add the appropriate setting to
the inputs.conf file and refresh the service.
admin
user's passwordThe module has the facility to set Splunk Enterprise's admin
password at installation time by leveraging the user-seed.conf method described as a best practice in the Splunk docs. The way Splunk implements this prevents Puppet from managing the password in an idempotent way but makes resetting the password through the web console possible. You can also use Puppet to do a one time reset too by setting the appropriate parameters on splunk::enterprise
but leaving these parameters set to true
will cause corrective change on each run of the Puppet Agent.
class { 'splunk::enterprise':
seed_password => true,
password_hash => '$6$jxSX7ra2SNzeJbYE$J95eTTMJjFr/lBoGYvuJUSNKvR7befnBwZUOvr/ky86QGqDXwEwdbgPMfCxW1/PuB/IkC94QLNravkABBkVkV1',
}
Alternatively the splunk::enterprise::password::seed
class can be used independently of the Puppet Agent through a Bolt Plan apply block.
This module has the ability to install and upgrade the splunk and splunkforwarder packages. All you have to do is declare package_ensure => 'latest'
when calling the ::splunk
or ::splunk::forwarder
classes.
The following code will install the 9.1.0 version of the splunk forwarder. Then comment out the 9.1.0 version and build values and uncomment the 9.2.0.1 version and build values. Running puppet again will perform the following:
# Tell the module to get packages directly from Splunk.
class { 'splunk::params':
version => '9.1.0',
build => '1c86ca0bacc3',
#version => '9.2.0.1',
#build => 'd8ae995bf219',
src_root => 'https://download.splunk.com',
}
# Specifying package_ensure => 'latest' will ensure that the splunk and
# splunkforwarder packages will be upgraded when you specify newer values for
# version and build.
class { 'splunk::forwarder':
package_ensure => 'latest',
}
See in file REFERENCE.md.
Learn how to get involved in this and other Vox Pupuli module development on our docs site.
See the CHANGELOG.md or list of contributors.