Skip to content

Commit

Permalink
Add support for SunOS/Solaris/Illumos/SmartOS (pcfens#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
smokris authored Jan 3, 2022
1 parent 4f8dcf5 commit 8e2fcb1
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
30 changes: 30 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,36 @@
}
} # end Linux

'SunOS' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => '/opt/local/bin/filebeat test config -c %',
}

file {'filebeat.yml':
ensure => $filebeat::file_ensure,
path => $filebeat::config_file,
content => template($filebeat::conf_template),
owner => $filebeat::config_file_owner,
group => $filebeat::config_file_group,
mode => $filebeat::config_file_mode,
validate_cmd => $validate_cmd,
notify => Service['filebeat'],
require => File['filebeat-config-dir'],
}

file {'filebeat-config-dir':
ensure => $filebeat::directory_ensure,
path => $filebeat::config_dir,
owner => $filebeat::config_dir_owner,
group => $filebeat::config_dir_group,
mode => $filebeat::config_dir_mode,
recurse => $filebeat::purge_conf_dir,
purge => $filebeat::purge_conf_dir,
force => true,
}
} # end SunOS

'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
Expand Down
18 changes: 18 additions & 0 deletions manifests/input.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@
}
}

'SunOS' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => "\"${filebeat::filebeat_path}\" -c \"${filebeat::config_file}\" test config",
}
file { "filebeat-${name}":
ensure => $ensure,
path => "${filebeat::config_dir}/${name}.yml",
owner => 'root',
group => 'root',
mode => $::filebeat::config_file_mode,
content => template("${module_name}/${input_template}"),
validate_cmd => $validate_cmd,
notify => Service['filebeat'],
require => File['filebeat.yml'],
}
}

'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
Expand Down
6 changes: 6 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
Class['filebeat::repo'] -> Class['filebeat::install::linux']
}
}
'SunOS': {
class{ '::filebeat::install::sunos':
notify => Class['filebeat::service'],
}
Anchor['filebeat::install::begin'] -> Class['filebeat::install::sunos'] -> Anchor['filebeat::install::end']
}
'FreeBSD': {
class{ '::filebeat::install::freebsd':
notify => Class['filebeat::service'],
Expand Down
6 changes: 6 additions & 0 deletions manifests/install/sunos.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# to manage filebeat installation on SunOS
class filebeat::install::sunos {
package {'beats':
ensure => $filebeat::package_ensure,
}
}
15 changes: 15 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@
$url_arch = undef
}

'SunOS': {
$package_ensure = present
$config_file = '/opt/local/etc/beats/filebeat.yml'
$config_dir = '/opt/local/etc/filebeat.d'
$config_file_owner = 'root'
$config_file_group = 'root'
$config_dir_owner = 'root'
$config_dir_group = 'root'
$modules_dir = '/opt/local/etc/filebeat.modules.d'
$tmp_dir = '/tmp'
$service_provider = undef
$install_dir = undef
$url_arch = undef
}

'FreeBSD': {
$package_ensure = present
$config_file = '/usr/local/etc/beats/filebeat.yml'
Expand Down

0 comments on commit 8e2fcb1

Please sign in to comment.