Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/log/master.pp

Issue 29333248: Issue 3306 - Create uplinks for pushing log files (Closed)
Patch Set: Created Jan. 6, 2016, 12:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/adblockplus/manifests/log/master.pp
diff --git a/modules/adblockplus/manifests/log/master.pp b/modules/adblockplus/manifests/log/master.pp
index 856cb7f512e87f67aadcdd413776a0b4b2c83b71..4e224a6e185e6b352bf4e145b82154c96e57f56d 100644
--- a/modules/adblockplus/manifests/log/master.pp
+++ b/modules/adblockplus/manifests/log/master.pp
@@ -3,10 +3,35 @@
# A server setup to collect and pre-process (i.e. anonymize and combine)
# log files using Logstash (https://logstash.net/) pipelines.
#
-class adblockplus::log::master {
+# === Parameters:
+#
+# [*uplinks*]
+# A hash of $name => $parameters resembling the servers registry within
+# file modules/private/hiera/hosts.yaml, which is used by default.
+#
+# === Examples:
+#
+# class {'adblockplus::log::master':
+# uplinks => {
+# 'filter1' => {
+# ip => '10.8.0.1',
+# ssh_public_key 'AAA...',
+# },
+# },
+# }
+#
+class adblockplus::log::master (
+ $uplinks = hiera('adblockplus::log::master::uplinks', hiera('servers', {})),
+) {
- include adblockplus
- realize(File[$adblockplus::directory])
+ include adblockplus::log
+ realize(File[$adblockplus::log::directory])
+ realize(User[$adblockplus::log::user])
+
+ # Used as internal constants within adblockplus::log::* resources
+ $data_directory = "$adblockplus::log::directory/data"
+ $uplink_directory = "$adblockplus::log::directory/uplink"
+ $import_script = '/usr/local/bin/adblockplus-log-import'
# Mapping hiera values explicitly becomes obsolete with Puppet 3.x
class {'logstash':
@@ -16,14 +41,41 @@ class adblockplus::log::master {
version => hiera('logstash::version', '1.4'),
}
+ # Location for input sockets in Logstash pipeline configurations
+ file {$uplink_directory:
+ ensure => 'directory',
+ group => $adblockplus::log::group,
+ mode => 0750,
+ owner => 'logstash',
+ require => [
+ File[$adblockplus::log::directory],
+ Package['logstash'],
+ User[$adblockplus::log::user],
+ ],
+ }
+
# Default location for output files in Logstash pipeline configurations
- file {"$adblockplus::directory/log":
+ file {$data_directory:
+ ensure => 'directory',
before => Service['logstash'],
group => 'logstash',
mode => 0775,
+ owner => 'root',
require => [
- File[$adblockplus::directory],
+ File[$adblockplus::log::directory],
Package['logstash'],
],
}
+
+ # The Python script dispatching incoming logs
+ file {$import_script:
+ ensure => 'present',
+ group => $adblockplus::log::user,
Fred 2016/01/07 15:19:16 Shouldn't this be $adblockplus::log::group?
mathias 2016/01/14 15:03:52 Actually it's obsolete. A fragment from an earlier
+ mode => 0755,
+ require => User[$adblockplus::log::user],
+ source => 'puppet:///modules/adblockplus/log/import.py',
+ }
+
+ # See modules/adblockplus/manifests/log/uplink.pp
+ create_resources('adblockplus::log::uplink', $uplinks)
}

Powered by Google App Engine
This is Rietveld