Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- stage: intake
env:
- TASK=test
- PUPPET_VERSION='~> 4.5.0'
- PUPPET_VERSION='~> 4.10.0'
- env:
- TASK=test
- env:
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ Include the `beats` class and pass a list of individual Beats to manage with `ma

```puppet
class { 'beats':
$managed_beats => ['metricbeat','auditbeat','heartbeat-elastic','packetbeat']
$managed_beats => [
'auditbeat',
'filebeat',
'heartbeat-elastic',
'journalbeat',
'metricbeat',
'packetbeat',
]
}
```

Expand All @@ -57,7 +64,14 @@ There is very few parameters you should need to customise. The most useful woul

```puppet
class { 'beats':
managed_beats => ['metricbeat','auditbeat','heartbeat-elastic','packetbeat'],
managed_beats => [
'auditbeat',
'filebeat',
'heartbeat-elastic',
'journalbeat',
'metricbeat',
'packetbeat',
],
config_root => '/opt/beats'
}
```
Expand Down
2 changes: 2 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ beats::config_root: '/etc'
beats::manage_repo: true
beats::managed_beats:
- 'auditbeat'
- 'filebeat'
- 'heartbeat-elastic'
- 'journalbeat'
- 'metricbeat'
- 'packetbeat'
beats::package_ensure: present
Expand Down
38 changes: 28 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
class beats::config {
$beats::managed_beats.each |String $beat| {
# Generate beat config name
$beat_config = "${beats::config_root}/${beat}/${beat}.yml"
if ( $beat == 'heartbeat-elastic' ) {
$ef_beat = 'heartbeat'
}
else { $ef_beat = $beat }


$beat_config = "${beats::config_root}/${ef_beat}/${ef_beat}.yml"

# Get beat settings
$settings = lookup("beats::${beat}::settings", Data, 'deep', undef)
Expand All @@ -19,24 +25,36 @@
}
}

# Set File defaults
File {
ensure => file,
path => $beat_config,
owner => 0,
group => 0,
mode => '0600',
notify => $_notify,
}
# # Set File defaults
# File {
# ensure => file,
# path => $beat_config,
# owner => 0,
# group => 0,
# mode => '0600',
# notify => $_notify,
# }

case type($settings) {
String: {
file { "${beat}_config":
ensure => 'file',
path => $beat_config,
owner => 0,
group => 0,
mode => '0600',
notify => $_notify,
source => $settings,
}
}
default: {
file { "${beat}_config":
ensure => 'file',
path => $beat_config,
owner => 0,
group => 0,
mode => '0600',
notify => $_notify,
content => epp('beats/beat.yml.epp', { beat => $beat, settings => $settings }),
}
}
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/nodesets/centos-7-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ HOSTS:
docker_pid_mode: 'host'
docker_preserve_image: true
docker_image_commands:
- yum install -y wget which cronie iproute
- yum install -y wget which cronie iproute augeas-devel
- mkdir -p /etc/selinux/targeted/contexts/
- echo '<busconfig><selinux></selinux></busconfig>' > /etc/selinux/targeted/contexts/dbus_contexts
- rm /lib/systemd/system/systemd*udev*
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/beats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
end
describe 'beats::install' do
it { is_expected.to contain_package('auditbeat') }
it { is_expected.to contain_package('filebeat') }
it { is_expected.to contain_package('heartbeat-elastic') }
it { is_expected.to contain_package('journalbeat') }
it { is_expected.to contain_package('metricbeat') }
it { is_expected.to contain_package('packetbeat') }
end
Expand All @@ -35,7 +37,9 @@
describe 'beats::service' do
it { is_expected.to contain_file('auditbeat_config') }
it { is_expected.to contain_service('auditbeat').that_subscribes_to('File[auditbeat_config]') }
it { is_expected.to contain_service('filebeat') }
it { is_expected.to contain_service('heartbeat-elastic') }
it { is_expected.to contain_service('journalbeat') }
it { is_expected.to contain_service('metricbeat') }
it { is_expected.to contain_service('packetbeat') }
end
Expand All @@ -53,7 +57,9 @@
end
describe 'beats::install' do
it { is_expected.not_to contain_package('auditbeat') }
it { is_expected.not_to contain_package('filebeat') }
it { is_expected.not_to contain_package('heartbeat-elastic') }
it { is_expected.not_to contain_package('journalbeat') }
it { is_expected.not_to contain_package('metricbeat') }
it { is_expected.not_to contain_package('packetbeat') }
end
Expand Down Expand Up @@ -85,7 +91,9 @@
end
describe 'beats::service' do
it { is_expected.not_to contain_service('auditbeat') }
it { is_expected.not_to contain_service('filebeat') }
it { is_expected.not_to contain_service('heartbeat-elastic') }
it { is_expected.not_to contain_service('journalbeat') }
it { is_expected.not_to contain_service('metricbeat') }
it { is_expected.not_to contain_service('packetbeat') }
end
Expand All @@ -104,7 +112,9 @@
describe 'beats::install' do
it { is_expected.to contain_package('metricbeat') }
it { is_expected.not_to contain_package('auditbeat') }
it { is_expected.not_to contain_package('filebeat') }
it { is_expected.not_to contain_package('heartbeat-elastic') }
it { is_expected.not_to contain_package('journalbeat') }
it { is_expected.not_to contain_package('packetbeat') }
end
describe 'beats::config' do
Expand All @@ -114,7 +124,9 @@
describe 'beats::service' do
it { is_expected.to contain_service('metricbeat') }
it { is_expected.not_to contain_service('auditbeat') }
it { is_expected.not_to contain_service('filebeat') }
it { is_expected.not_to contain_service('heartbeat-elastic') }
it { is_expected.not_to contain_service('journalbeat') }
it { is_expected.not_to contain_service('packetbeat') }
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/type_aliases/managed_beats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
describe 'with valid inputs' do
[
['auditbeat'],
['filebeat'],
['heartbeat-elastic'],
['journalbeat'],
['metricbeat'],
['packetbeat'],
%w[auditbeat heartbeat-elastic],
Expand Down
11 changes: 10 additions & 1 deletion types/managed_beats.pp
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
type Beats::Managed_beats = Array[Enum['auditbeat', 'heartbeat-elastic', 'metricbeat', 'packetbeat']]
type Beats::Managed_beats = Array[
Enum[
'auditbeat',
'filebeat',
'heartbeat-elastic',
'journalbeat',
'metricbeat',
'packetbeat',
]
]