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

Side by Side Diff: modules/adblockplus/manifests/log.pp

Issue 29339248: Issue 3305 - Introduce adblockplus::log::tracker and ::forwarder (Closed)
Patch Set: Created April 1, 2016, 9:12 a.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 1 # == Class: adblockplus::log
2 # 2 #
3 # Default root namespace for integrating custom logging entities. 3 # Default root namespace for integrating custom logging entities.
4 # 4 #
5 # === Parameters: 5 # === Parameters:
6 # 6 #
7 # [*ensure*] 7 # [*ensure*]
8 # Whether associated resources are ment to be 'present' or 'absent'. 8 # Whether associated resources are ment to be 'present' or 'absent'.
9 # 9 #
10 # [*name*]
11 # Used as label to connect adblockplus::log::tracker instances to class
12 # adblockplus::log::forwarder, defaults to 'adblockplus::log'.
13 #
10 # [*rotations*] 14 # [*rotations*]
11 # A hash of adblockplus::log::rotation $name => $parameter items 15 # A hash of adblockplus::log::rotation $name => $parameter items
12 # to set up in this context, i.e. via Hiera. 16 # to set up in this context, i.e. via Hiera.
13 # 17 #
18 # [*trackers*]
19 # A has of adblockplus::log::rotation $title => $parameter items
Fred 2016/04/06 18:03:03 Typo (hash)
mathias 2016/04/06 19:16:27 Acknowledged.
20 # to set up in this context, i.e. via Hiera.
21 #
14 # === Examples: 22 # === Examples:
15 # 23 #
16 # class {'adblockplus::log': 24 # class {'adblockplus::log':
17 # rotations => { 25 # rotations => {
18 # # see adblockplus::log::rotation 26 # # see adblockplus::log::rotation
19 # }, 27 # },
28 # trackers => {
29 # # see adblockplus::log::tracker
30 # },
20 # } 31 # }
21 # 32 #
22 class adblockplus::log ( 33 class adblockplus::log (
23 $ensure = 'present', 34 $ensure = 'present',
24 $rotations = hiera('adblockplus::log::rotations', {}), 35 $rotations = hiera('adblockplus::log::rotations', {}),
36 $trackers = hiera('adblockplus::log::trackers', {}),
25 ) { 37 ) {
26 38
27 include adblockplus 39 include adblockplus
40 include stdlib
28 41
29 # Used as internal constants within adblockplus::log::* resources 42 # Used as internal constants within adblockplus::log::* resources
30 $directory = "$adblockplus::directory/log" 43 $directory = "$adblockplus::directory/log/data"
31 $group = 'adm'
32 $user = 'log' 44 $user = 'log'
33 45
34 # Required on both log generating and log processing hosts 46 # Required on both log generating and log processing hosts
35 class {'fluent': 47 class {'fluent':
36 package => { 48 package => {
37 ensure => $ensure ? { 49 ensure => $ensure ? {
38 'present' => '2.3.1-0', 50 'present' => '2.3.1-0',
39 default => 'absent', 51 default => 'absent',
40 }, 52 },
41 provider => 'apt', 53 provider => 'apt',
42 }, 54 },
43 user => { 55 user => {
44 groups => [$group], 56 groups => ['adm'],
45 shell => '/bin/sh', 57 shell => '/bin/sh',
46 } 58 },
59 }
60
61 # Used as internal shortcuts within adblockplus::log::* resources
62 $agent = getparam(Package['fluent'], 'name')
63 $index = sprintf('/var/run/%s/index.csv', $agent)
64 $group = getparam(User['fluent'], 'gid')
65
66 fluent::config {$title:
67 content => template('adblockplus/log/fluentd/default.conf.erb'),
68 ensure => $ensure,
69 name => '90-adblockplus-log-defaults',
47 } 70 }
48 71
49 # Invoke realize(File[$adblockplus::log::directory]) when neccessary 72 # Invoke realize(File[$adblockplus::log::directory]) when neccessary
50 @file {$directory: 73 @file {$directory:
74 before => Service['fluent'],
51 ensure => 'directory', 75 ensure => 'directory',
52 group => $group, 76 group => $group,
53 mode => 0750, 77 mode => 0775,
54 owner => 'root', 78 owner => $user,
55 require => File[$adblockplus::directory],
56 } 79 }
57 80
58 # Invoke realize(User[$adblockplus::log::user]) when necessary 81 # Invoke realize(User[$adblockplus::log::user]) when necessary
59 @user {$user: 82 @user {$user:
83 before => File[$directory],
60 ensure => $ensure, 84 ensure => $ensure,
85 groups => [$group],
86 home => "$adblockplus::directory/log",
61 managehome => true, 87 managehome => true,
62 groups => [$group], 88 require => [
89 File[$adblockplus::directory],
90 User['fluent'],
91 ],
63 } 92 }
64 93
65 # See modules/adblockplus/manifests/log/rotation.pp 94 # See modules/adblockplus/manifests/log/rotation.pp
66 create_resources('adblockplus::log::rotation', $rotations) 95 create_resources('adblockplus::log::rotation', $rotations)
96
97 # See modules/adblockplus/manifests/log/tracker.pp
98 create_resources('adblockplus::log::tracker', $trackers)
67 } 99 }
OLDNEW
« no previous file with comments | « no previous file | modules/adblockplus/manifests/log/forwarder.pp » ('j') | modules/adblockplus/manifests/log/tracker.pp » ('J')

Powered by Google App Engine
This is Rietveld