Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deploymentclient types #141

Merged
merged 1 commit into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/puppet/provider/splunk_deploymentclient/ini_setting.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Puppet::Type.type(:splunk_deploymentclient).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
) do
def self.file_name
'system/local/deploymentclient.conf'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Puppet::Type.type(:splunkforwarder_deploymentclient).provide(
:ini_setting,
parent: Puppet::Type.type(:ini_setting).provider(:splunk)
) do
def self.file_name
'system/local/deploymentclient.conf'
end
end
42 changes: 24 additions & 18 deletions lib/puppet/type/splunk_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
:purge_alert_actions,
:purge_authentication,
:purge_authorize,
:purge_deploymentclient,
:purge_distsearch,
:purge_indexes,
:purge_limits,
Expand All @@ -35,6 +36,7 @@
:purge_transforms,
:purge_web,
:purge_uiprefs,
:purge_forwarder_deploymentclient,
:purge_forwarder_inputs,
:purge_forwarder_outputs,
:purge_forwarder_props,
Expand All @@ -57,24 +59,26 @@ def generate
resources = []

{
Puppet::Type::Splunk_output => self[:purge_outputs],
Puppet::Type::Splunk_input => self[:purge_inputs],
Puppet::Type::Splunk_alert_actions => self[:purge_alert_actions],
Puppet::Type::Splunk_authentication => self[:purge_authentication],
Puppet::Type::Splunk_authorize => self[:purge_authorize],
Puppet::Type::Splunk_distsearch => self[:purge_distsearch],
Puppet::Type::Splunk_indexes => self[:purge_indexes],
Puppet::Type::Splunk_props => self[:purge_props],
Puppet::Type::Splunk_server => self[:purge_server],
Puppet::Type::Splunk_transforms => self[:purge_transforms],
Puppet::Type::Splunk_web => self[:purge_web],
Puppet::Type::Splunk_uiprefs => self[:purge_uiprefs],
Puppet::Type::Splunkforwarder_input => self[:purge_forwarder_inputs],
Puppet::Type::Splunkforwarder_output => self[:purge_forwarder_outputs],
Puppet::Type::Splunkforwarder_props => self[:purge_forwarder_props],
Puppet::Type::Splunkforwarder_transforms => self[:purge_forwarder_transforms],
Puppet::Type::Splunkforwarder_web => self[:purge_forwarder_web],
Puppet::Type::Splunkforwarder_server => self[:purge_forwarder_server]
Puppet::Type::Splunk_alert_actions => self[:purge_alert_actions],
Puppet::Type::Splunk_output => self[:purge_outputs],
Puppet::Type::Splunk_input => self[:purge_inputs],
Puppet::Type::Splunk_authentication => self[:purge_authentication],
Puppet::Type::Splunk_authorize => self[:purge_authorize],
Puppet::Type::Splunk_deploymentclient => self[:purge_deploymentclient],
Puppet::Type::Splunk_distsearch => self[:purge_distsearch],
Puppet::Type::Splunk_indexes => self[:purge_indexes],
Puppet::Type::Splunk_props => self[:purge_props],
Puppet::Type::Splunk_server => self[:purge_server],
Puppet::Type::Splunk_transforms => self[:purge_transforms],
Puppet::Type::Splunk_web => self[:purge_web],
Puppet::Type::Splunk_uiprefs => self[:purge_uiprefs],
Puppet::Type::Splunkforwarder_deploymentclient => self[:purge_forwarder_deploymentclient],
Puppet::Type::Splunkforwarder_input => self[:purge_forwarder_inputs],
Puppet::Type::Splunkforwarder_output => self[:purge_forwarder_outputs],
Puppet::Type::Splunkforwarder_props => self[:purge_forwarder_props],
Puppet::Type::Splunkforwarder_transforms => self[:purge_forwarder_transforms],
Puppet::Type::Splunkforwarder_web => self[:purge_forwarder_web],
Puppet::Type::Splunkforwarder_server => self[:purge_forwarder_server]
}.each do |k, purge|
resources.concat(purge_splunk_resources(k)) if purge == :true
end
Expand All @@ -87,6 +91,7 @@ def set_provider_paths
:splunk_alert_actions,
:splunk_authentication,
:splunk_authorize,
:splunk_deploymentclient,
:splunk_distsearch,
:splunk_indexes,
:splunk_limits,
Expand All @@ -102,6 +107,7 @@ def set_provider_paths
provider_class.file_path = self[:server_confdir]
end
[
:splunkforwarder_deploymentclient,
:splunkforwarder_input,
:splunkforwarder_output,
:splunkforwarder_props,
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/type/splunk_deploymentclient.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(:splunk_deploymentclient) do
@doc = 'Manage splunk deploymentclient entries in deploymentclient.conf'
PuppetX::Puppetlabs::Splunk::Type.clone_type(self)
end
6 changes: 6 additions & 0 deletions lib/puppet/type/splunkforwarder_deploymentclient.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_deploymentclient) do
@doc = 'Manage splunkforwarder deploymentclient entries in deploymentclient.conf'
PuppetX::Puppetlabs::Splunk::Type.clone_type(self)
end
72 changes: 40 additions & 32 deletions manifests/forwarder.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@
# Requires: nothing
#
class splunk::forwarder (
$server = $splunk::params::server,
$package_source = $splunk::params::forwarder_pkg_src,
$package_name = $splunk::params::forwarder_pkg_name,
$package_ensure = $splunk::params::forwarder_pkg_ensure,
$logging_port = $splunk::params::logging_port,
$splunkd_port = $splunk::params::splunkd_port,
$install_options = $splunk::params::forwarder_install_options,
$splunk_user = $splunk::params::splunk_user,
$splunkd_listen = '127.0.0.1',
$purge_inputs = false,
$purge_outputs = false,
$purge_props = false,
$purge_transforms = false,
$purge_web = false,
$pkg_provider = $splunk::params::pkg_provider,
$forwarder_confdir = $splunk::params::forwarder_confdir,
$forwarder_output = $splunk::params::forwarder_output,
$forwarder_input = $splunk::params::forwarder_input,
$create_password = $splunk::params::create_password,
$addons = {},
$server = $splunk::params::server,
$package_source = $splunk::params::forwarder_pkg_src,
$package_name = $splunk::params::forwarder_pkg_name,
$package_ensure = $splunk::params::forwarder_pkg_ensure,
$logging_port = $splunk::params::logging_port,
$splunkd_port = $splunk::params::splunkd_port,
$install_options = $splunk::params::forwarder_install_options,
$splunk_user = $splunk::params::splunk_user,
$splunkd_listen = '127.0.0.1',
$purge_deploymentclient = false,
$purge_inputs = false,
$purge_outputs = false,
$purge_props = false,
$purge_transforms = false,
$purge_web = false,
$pkg_provider = $splunk::params::pkg_provider,
$forwarder_confdir = $splunk::params::forwarder_confdir,
$forwarder_output = $splunk::params::forwarder_output,
$forwarder_input = $splunk::params::forwarder_input,
$create_password = $splunk::params::create_password,
$addons = {},
) inherits splunk::params {

$virtual_service = $splunk::params::forwarder_service
Expand Down Expand Up @@ -123,11 +124,12 @@
# the respective config files.

Splunk_config['splunk'] {
purge_forwarder_outputs => $purge_outputs,
purge_forwarder_inputs => $purge_inputs,
purge_forwarder_props => $purge_props,
purge_forwarder_transforms => $purge_transforms,
purge_forwarder_web => $purge_web,
purge_forwarder_deploymentclient => $purge_deploymentclient,
purge_forwarder_outputs => $purge_outputs,
purge_forwarder_inputs => $purge_inputs,
purge_forwarder_props => $purge_props,
purge_forwarder_transforms => $purge_transforms,
purge_forwarder_web => $purge_web,
}

# This is a module that supports multiple platforms. For some platforms
Expand All @@ -154,13 +156,14 @@
-> Exec <| tag == 'splunk_forwarder' |>
-> Service[$virtual_service]

Package[$package_name] -> Splunkforwarder_output<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_input<||> ~> Service[$virtual_service]
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]
Package[$package_name] -> Splunkforwarder_deploymentclient<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_output<||> ~> Service[$virtual_service]
Package[$package_name] -> Splunkforwarder_input<||> ~> Service[$virtual_service]
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 @@ -171,6 +174,11 @@
}
}

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

file { "${forwarder_confdir}/system/local/inputs.conf":
ensure => file,
tag => 'splunk_forwarder',
Expand Down
82 changes: 47 additions & 35 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,30 @@
# Requires: nothing
#
class splunk (
$package_source = $splunk::params::server_pkg_src,
$package_name = $splunk::params::server_pkg_name,
$package_ensure = $splunk::params::server_pkg_ensure,
$server_service = $splunk::params::server_service,
$logging_port = $splunk::params::logging_port,
$splunkd_port = $splunk::params::splunkd_port,
$splunk_user = $splunk::params::splunk_user,
$pkg_provider = $splunk::params::pkg_provider,
$splunkd_listen = '127.0.0.1',
$web_port = '8000',
$purge_alert_actions = false,
$purge_authentication = false,
$purge_authorize = false,
$purge_distsearch = false,
$purge_indexes = false,
$purge_inputs = false,
$purge_limits = false,
$purge_outputs = false,
$purge_props = false,
$purge_server = false,
$purge_transforms = false,
$purge_uiprefs = false,
$purge_web = false,
$package_source = $splunk::params::server_pkg_src,
$package_name = $splunk::params::server_pkg_name,
$package_ensure = $splunk::params::server_pkg_ensure,
$server_service = $splunk::params::server_service,
$logging_port = $splunk::params::logging_port,
$splunkd_port = $splunk::params::splunkd_port,
$splunk_user = $splunk::params::splunk_user,
$pkg_provider = $splunk::params::pkg_provider,
$splunkd_listen = '127.0.0.1',
$web_port = '8000',
$purge_alert_actions = false,
$purge_authentication = false,
$purge_authorize = false,
$purge_deploymentclient = false,
$purge_distsearch = false,
$purge_indexes = false,
$purge_inputs = false,
$purge_limits = false,
$purge_outputs = false,
$purge_props = false,
$purge_server = false,
$purge_transforms = false,
$purge_uiprefs = false,
$purge_web = false,
) inherits splunk::params {

$virtual_service = $server_service
Expand Down Expand Up @@ -131,18 +132,19 @@
# Purge resources if option set
Splunk_config['splunk'] {
purge_alert_actions => $purge_alert_actions,
purge_authentication => $purge_authentication,
purge_authorize => $purge_authorize,
purge_distsearch => $purge_distsearch,
purge_indexes => $purge_indexes,
purge_inputs => $purge_inputs,
purge_limits => $purge_limits,
purge_outputs => $purge_outputs,
purge_props => $purge_props,
purge_server => $purge_server,
purge_transforms => $purge_transforms,
purge_uiprefs => $purge_uiprefs,
purge_web => $purge_web
purge_authentication => $purge_authentication,
purge_authorize => $purge_authorize,
purge_deploymentclient => $purge_deploymentclient,
purge_distsearch => $purge_distsearch,
purge_indexes => $purge_indexes,
purge_inputs => $purge_inputs,
purge_limits => $purge_limits,
purge_outputs => $purge_outputs,
purge_props => $purge_props,
purge_server => $purge_server,
purge_transforms => $purge_transforms,
purge_uiprefs => $purge_uiprefs,
purge_web => $purge_web
}
# This is a module that supports multiple platforms. For some platforms
# there is non-generic configuration that needs to be declared in addition
Expand Down Expand Up @@ -187,6 +189,11 @@
-> Splunk_authorize <| tag == 'splunk_server' |>
~> Service[$virtual_service]

Package[$package_name]
-> File <| tag == 'splunk_server' |>
-> Splunk_deploymentclient <| tag == 'splunk_server' |>
~> Service[$virtual_service]

Package[$package_name]
-> File <| tag == 'splunk_server' |>
-> Splunk_distsearch <| tag == 'splunk_server' |>
Expand Down Expand Up @@ -258,6 +265,11 @@
tag => 'splunk_server',
}

file { '/opt/splunk/etc/system/local/deploymentclient.conf':
ensure => file,
tag => 'splunk_server',
}

file { '/opt/splunk/etc/system/local/distsearch.conf':
ensure => file,
tag => 'splunk_server',
Expand Down