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: Issue 3306 - Address feedback from code-review Created Jan. 14, 2016, 3:05 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
« no previous file with comments | « modules/adblockplus/manifests/log.pp ('k') | modules/adblockplus/manifests/log/uplink.pp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7214a0d0c73f9913eba0de401e4bb1311a2ca37a 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,40 @@ 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',
+ 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)
}
« no previous file with comments | « modules/adblockplus/manifests/log.pp ('k') | modules/adblockplus/manifests/log/uplink.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld