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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # == Class: adblockplus::log::master 1 # == Class: adblockplus::log::master
2 # 2 #
3 # A server setup to collect and pre-process (i.e. anonymize and combine) 3 # A server setup to collect and pre-process (i.e. anonymize and combine)
4 # log files using Logstash (https://logstash.net/) pipelines. 4 # log files using Logstash (https://logstash.net/) pipelines.
5 # 5 #
6 class adblockplus::log::master { 6 # === Parameters:
7 #
8 # [*uplinks*]
9 # A hash of $name => $parameters resembling the servers registry within
10 # file modules/private/hiera/hosts.yaml, which is used by default.
11 #
12 # === Examples:
13 #
14 # class {'adblockplus::log::master':
15 # uplinks => {
16 # 'filter1' => {
17 # ip => '10.8.0.1',
18 # ssh_public_key 'AAA...',
19 # },
20 # },
21 # }
22 #
23 class adblockplus::log::master (
24 $uplinks = hiera('adblockplus::log::master::uplinks', hiera('servers', {})),
25 ) {
7 26
8 include adblockplus 27 include adblockplus::log
9 realize(File[$adblockplus::directory]) 28 realize(File[$adblockplus::log::directory])
29 realize(User[$adblockplus::log::user])
30
31 # Used as internal constants within adblockplus::log::* resources
32 $data_directory = "$adblockplus::log::directory/data"
33 $uplink_directory = "$adblockplus::log::directory/uplink"
34 $import_script = '/usr/local/bin/adblockplus-log-import'
10 35
11 # Mapping hiera values explicitly becomes obsolete with Puppet 3.x 36 # Mapping hiera values explicitly becomes obsolete with Puppet 3.x
12 class {'logstash': 37 class {'logstash':
13 contrib => hiera('logstash::contrib', false), 38 contrib => hiera('logstash::contrib', false),
14 ensure => hiera('logstash::ensure', 'running'), 39 ensure => hiera('logstash::ensure', 'running'),
15 pipelines => hiera('logstash::pipelines', {}), 40 pipelines => hiera('logstash::pipelines', {}),
16 version => hiera('logstash::version', '1.4'), 41 version => hiera('logstash::version', '1.4'),
17 } 42 }
18 43
44 # Location for input sockets in Logstash pipeline configurations
45 file {$uplink_directory:
46 ensure => 'directory',
47 group => $adblockplus::log::group,
48 mode => 0750,
49 owner => 'logstash',
50 require => [
51 File[$adblockplus::log::directory],
52 Package['logstash'],
53 User[$adblockplus::log::user],
54 ],
55 }
56
19 # Default location for output files in Logstash pipeline configurations 57 # Default location for output files in Logstash pipeline configurations
20 file {"$adblockplus::directory/log": 58 file {$data_directory:
59 ensure => 'directory',
21 before => Service['logstash'], 60 before => Service['logstash'],
22 group => 'logstash', 61 group => 'logstash',
23 mode => 0775, 62 mode => 0775,
63 owner => 'root',
24 require => [ 64 require => [
25 File[$adblockplus::directory], 65 File[$adblockplus::log::directory],
26 Package['logstash'], 66 Package['logstash'],
27 ], 67 ],
28 } 68 }
69
70 # The Python script dispatching incoming logs
71 file {$import_script:
72 ensure => 'present',
73 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
74 mode => 0755,
75 require => User[$adblockplus::log::user],
76 source => 'puppet:///modules/adblockplus/log/import.py',
77 }
78
79 # See modules/adblockplus/manifests/log/uplink.pp
80 create_resources('adblockplus::log::uplink', $uplinks)
29 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld