OLD | NEW |
(Empty) | |
| 1 # == Type: adblockplus::telemetry::endpoint |
| 2 # |
| 3 # Manage POST endoints of the $adblockplus::telemetry::domain. |
| 4 # |
| 5 # === Parameters: |
| 6 # |
| 7 # [*ensure*] |
| 8 # Whether the endpoint should be 'present' or 'absent'/'purged'. |
| 9 # |
| 10 # [*location*] |
| 11 # The path to the endpoint within the $adblockplus::telemtry::domain, |
| 12 # i.e. https://telemetry.adblockplus.org/$location (defaults to /$name). |
| 13 # |
| 14 # [*name*] |
| 15 # Identifies the data file (i.e. /var/log/nginx/telemetry_log_$name). |
| 16 # |
| 17 # === Examples: |
| 18 # |
| 19 # adblockplus::telemetry::endpoint {'filter-hit-statistics': |
| 20 # ensure = 'present', |
| 21 # location = '/submit/filter-hit-statistics', |
| 22 # } |
| 23 # |
| 24 define adblockplus::telemetry::endpoint ( |
| 25 $ensure = 'present', |
| 26 $location = "/$name", |
| 27 ) { |
| 28 |
| 29 include adblockplus::telemetry |
| 30 include nginx |
| 31 |
| 32 $ensure_presence = $ensure ? { |
| 33 /^(absent|purged)$/ => 'absent', |
| 34 default => 'present', |
| 35 } |
| 36 |
| 37 $id = "adblockplus::telemetry::endpoint#$name" |
| 38 $logfile = "/var/log/nginx/telemetry_log_$name" |
| 39 |
| 40 concat::fragment {$id: |
| 41 content => template('adblockplus/telemetry/endpoint.conf.erb'), |
| 42 ensure => $ensure_presence, |
| 43 notify => Service['nginx'], |
| 44 order => 4, |
| 45 target => $adblockplus::telemetry::endpoints_config_name, |
| 46 } |
| 47 |
| 48 logrotate::config {$id: |
| 49 content => template('adblockplus/telemetry/logrotate.erb'), |
| 50 ensure => $ensure_presence, |
| 51 name => "telemetry_$name", |
| 52 } |
| 53 } |
OLD | NEW |