Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/filebeat.pp
# Filebeat apache log shipper profile | # Filebeat apache log shipper profile | ||||
class profile::filebeat { | class profile::filebeat { | ||||
$config_directory = '/etc/filebeat' | |||||
olasd: For now we've mostly avoided using class arguments for profiles, to avoid being surprised by… | |||||
$config_file = 'filebeat.yml' | |||||
$config_path = "${config_directory}/${config_file}" | |||||
include ::profile::elastic::apt_config | include ::profile::elastic::apt_config | ||||
$version = lookup('elastic::elk_version') | $version = lookup('elastic::elk_version') | ||||
package { 'filebeat': | package { 'filebeat': | ||||
ensure => $version, | ensure => $version, | ||||
} | } | ||||
apt::pin { 'filebeat': | apt::pin { 'filebeat': | ||||
packages => 'filebeat', | packages => 'filebeat', | ||||
version => $version, | version => $version, | ||||
priority => 1001, | priority => 1001, | ||||
} | } | ||||
service { 'filebeat': | service { 'filebeat': | ||||
ensure => running, | ensure => running, | ||||
enable => true, | enable => true, | ||||
} | } | ||||
file { "${config_directory}/inputs.d": | |||||
Not Done Inline Actionsmisaligned => olasd: misaligned `=>` | |||||
ensure => directory, | |||||
Not Done Inline ActionsNeeds an explicit owner, group and mode (probably '0644'). Also should consider using the purge attribute to remove leftover files. olasd: Needs an explicit owner, group and mode (probably '0644'). Also should consider using the… | |||||
purge => true, | |||||
owner => 'root', | |||||
group => 'root', | |||||
mode => '0755', | |||||
require => Package['filebeat'], | |||||
} | |||||
$filebeat_config = lookup('filebeat::config') | |||||
file { $config_path : | |||||
ensure => present, | |||||
content => inline_yaml($filebeat_config), | |||||
owner => 'root', | |||||
group => 'root', | |||||
mode => '0644', | |||||
require => [Package['filebeat']], | |||||
notify => Service['filebeat'], | |||||
} | |||||
} | } |
For now we've mostly avoided using class arguments for profiles, to avoid being surprised by hiera variable "autoloading".
(what i mean by hiera autoloading : if you set a profile::filebeat::config_directory hiera variable, it'll override the "'/etc/filebeat'" you've set here)
I don't know if that's a sensible choice, and it can certainly be reconsidered, but for now I think we should keep it consistent.