From 8e2fcb1a6a5de4bedae516167fcb33891dc496c9 Mon Sep 17 00:00:00 2001 From: Steve Mokris Date: Sun, 2 Jan 2022 22:46:50 -0500 Subject: [PATCH] Add support for SunOS/Solaris/Illumos/SmartOS (#296) --- manifests/config.pp | 30 ++++++++++++++++++++++++++++++ manifests/input.pp | 18 ++++++++++++++++++ manifests/install.pp | 6 ++++++ manifests/install/sunos.pp | 6 ++++++ manifests/params.pp | 15 +++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 manifests/install/sunos.pp diff --git a/manifests/config.pp b/manifests/config.pp index 15cd014a..5f514ef6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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, diff --git a/manifests/input.pp b/manifests/input.pp index ff92654a..8fcc7d5f 100644 --- a/manifests/input.pp +++ b/manifests/input.pp @@ -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, diff --git a/manifests/install.pp b/manifests/install.pp index 633ca498..e734f853 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -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'], diff --git a/manifests/install/sunos.pp b/manifests/install/sunos.pp new file mode 100644 index 00000000..ce892f2e --- /dev/null +++ b/manifests/install/sunos.pp @@ -0,0 +1,6 @@ +# to manage filebeat installation on SunOS +class filebeat::install::sunos { + package {'beats': + ensure => $filebeat::package_ensure, + } +} diff --git a/manifests/params.pp b/manifests/params.pp index 0ae70ab1..3e5f0d85 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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'