Skip to content

Commit

Permalink
Merge pull request #118 from nicholaspearson/feature/splunk_forwarders
Browse files Browse the repository at this point in the history
Added splunkforwarder_server and splunkforwarder_limits providers/types.
  • Loading branch information
bastelfreak authored Jul 24, 2017
2 parents 80e4c6d + cc4b5dd commit 446386e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ the inputs.conf file and refresh the service.
* `splunkforwarder_props`: Used to manage ini settings in [props.conf][props.conf-docs]
* `splunkforwarder_transforms`: Used to manage ini settings in [transforms.conf][transforms.conf-docs]
* `splunkforwarder_web`: Used to manage ini settings in [web.conf][web.conf-docs]
* `splunkforwarder_limits`: Used to manage ini settings in [limits.conf][limits.conf-docs]
* `splunkforwarder_server`: Used to manage ini settings in [server.conf][server.conf-docs]

All of the above types use `puppetlabs/ini_file` as a parent and are declared in
an identical way, and accept the following parameters:
Expand Down
8 changes: 8 additions & 0 deletions lib/puppet/provider/splunkforwarder_limits/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Puppet::Type.type(:splunkforwarder_limits).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
) do
def self.file_name
'limits.conf'
end
end
8 changes: 8 additions & 0 deletions lib/puppet/provider/splunkforwarder_server/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Puppet::Type.type(:splunkforwarder_server).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
) do
def self.file_name
'server.conf'
end
end
6 changes: 6 additions & 0 deletions lib/puppet/type/splunkforwarder_limits.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_limits) do
@doc = 'Manage splunkforwarder limit settings in limits.conf'
PuppetX::Puppetlabs::Splunk::Type.clone_type(self)
end
6 changes: 6 additions & 0 deletions lib/puppet/type/splunkforwarder_server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require File.join(File.dirname(__FILE__), '..', '..', 'puppet_x/puppetlabs/splunk/type')

Puppet::Type.newtype(:splunkforwarder_server) do
@doc = 'Manage splunkforwarder server settings in server.conf'
PuppetX::Puppetlabs::Splunk::Type.clone_type(self)
end
12 changes: 12 additions & 0 deletions manifests/forwarder.pp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@
Package[$package_name] -> Splunkforwarder_props<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_transforms<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_web<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_limits<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_server<||> ~> Service[$virtual_service]

File {
owner => $splunk_user,
Expand All @@ -185,6 +187,16 @@
tag => 'splunk_forwarder',
}

file { "${forwarder_confdir}/system/local/limits.conf":
ensure => file,
tag => 'splunk_forwarder',
}

file { "${forwarder_confdir}/system/local/server.conf":
ensure => file,
tag => 'splunk_forwarder',
}

# Validate: if both Splunk and Splunk Universal Forwarder are installed on
# the same system, then they must use different admin ports.
if (defined(Class['splunk']) and defined(Class['splunk::forwarder'])) {
Expand Down

0 comments on commit 446386e

Please sign in to comment.