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

Unified Diff: modules/adblockplus/manifests/telemetry.pp

Issue 29329669: Issue 3261 - Introduce module adblockplus::telemetry (Closed)
Patch Set: Created Nov. 3, 2015, 4:46 a.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/telemetry.pp
diff --git a/modules/adblockplus/manifests/telemetry.pp b/modules/adblockplus/manifests/telemetry.pp
new file mode 100644
index 0000000000000000000000000000000000000000..6470684020c69bbce5afc3b18e65535084178861
--- /dev/null
+++ b/modules/adblockplus/manifests/telemetry.pp
@@ -0,0 +1,62 @@
+# == Class: adblockplus::telemetry
+#
+# A receiver for incoming statistic data and reports.
+#
+# === Parameters:
+#
+# [*domain*]
+# The authorative domain to bind to, although the setup will ensure
+# the host being the one used by default.
+#
+# [*endpoints*]
+# A hash of adblockplus::telemetry::endpoin setup parameters to become
Fred 2015/11/05 13:59:48 Typo: endpoint
+# included with the class.
+#
+# [*ssl_cert*]
+# If provided, the host will bind to HTTPS, and redirect from HTTP.
+# Requires $ssl_key to be given as well.
+#
+# [*ssl_key*]
+# The private SSL key the $ssl_cert is associated with.
+#
+# === Examples:
+#
+# class {'adblockplus::telemetry':
+# domain => 'telemetry.adblockplus.org',
+# endpoints => {
+# # see adblockplus::telementry::endpoint
Fred 2015/11/05 13:59:47 Typo: telemetry
+# },
+# }
+#
+class adblockplus::telemetry (
+ $domain,
+ $endpoints = hiera('adblockplus::telemetry::endpoints', {}),
+ $ssl_cert = hiera('adblockplus::telemetry::ssl_cert', ''),
+ $ssl_key = hiera('adblockplus::telemetry::ssl_key', ''),
+) {
+
+ include adblockplus
+ include nginx
+
+ $endpoints_config_name = 'adblockplus::telemetry#endpoints'
+ $endpoints_config_path = '/etc/nginx/adblockplus_telemetry_endpoints.conf'
+
+ concat {$endpoints_config_name:
+ notify => Service['nginx'],
+ path => $endpoints_config_path,
+ require => Package['nginx'],
+ }
+
+ create_resources('adblockplus::telemetry::endpoint', $endpoints, {
+ ensure => 'present',
+ })
+
+ nginx::hostconfig {$domain:
+ certificate => $ssl_cert ? {'' => undef, default => $ssl_cert},
+ content => "include $endpoints_config_path;\n",
+ is_default => true,
+ private_key => $ssl_key ? {'' => undef, default => $ssl_key},
+ log => 'access_log_telemetry',
+ require => Concat[$endpoints_config_name],
+ }
+}

Powered by Google App Engine
This is Rietveld