| OLD | NEW |
| 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*] |
| 8 # Whether associated resources are ment to be 'present' or 'absent'. |
| 9 # |
| 7 # [*rotations*] | 10 # [*rotations*] |
| 8 # A hash of adblockplus::log::rotation $name => $parameter items | 11 # A hash of adblockplus::log::rotation $name => $parameter items |
| 9 # to set up in this context, i.e. via Hiera. | 12 # to set up in this context, i.e. via Hiera. |
| 10 # | 13 # |
| 11 # === Examples: | 14 # === Examples: |
| 12 # | 15 # |
| 13 # class {'adblockplus::log': | 16 # class {'adblockplus::log': |
| 14 # rotations => { | 17 # rotations => { |
| 15 # # see adblockplus::log::rotation | 18 # # see adblockplus::log::rotation |
| 16 # }, | 19 # }, |
| 17 # } | 20 # } |
| 18 # | 21 # |
| 19 class adblockplus::log ( | 22 class adblockplus::log ( |
| 23 $ensure = 'present', |
| 20 $rotations = hiera('adblockplus::log::rotations', {}), | 24 $rotations = hiera('adblockplus::log::rotations', {}), |
| 21 ) { | 25 ) { |
| 22 | 26 |
| 23 include adblockplus | 27 include adblockplus |
| 24 realize(File[$adblockplus::directory]) | |
| 25 | 28 |
| 26 # Used as internal constants within adblockplus::log::* resources | 29 # Used as internal constants within adblockplus::log::* resources |
| 27 $directory = "$adblockplus::directory/log" | 30 $directory = "$adblockplus::directory/log" |
| 28 $group = 'log' | 31 $group = 'adm' |
| 29 $user = 'log' | 32 $user = 'log' |
| 30 | 33 |
| 34 # Required on both log generating and log processing hosts |
| 35 class {'fluent': |
| 36 package => { |
| 37 ensure => $ensure ? { |
| 38 'present' => '2.3.1-0', |
| 39 default => 'absent', |
| 40 }, |
| 41 provider => 'apt', |
| 42 }, |
| 43 user => { |
| 44 groups => [$group], |
| 45 shell => '/bin/sh', |
| 46 } |
| 47 } |
| 48 |
| 31 # Invoke realize(File[$adblockplus::log::directory]) when neccessary | 49 # Invoke realize(File[$adblockplus::log::directory]) when neccessary |
| 32 @file {$directory: | 50 @file {$directory: |
| 33 ensure => 'directory', | 51 ensure => 'directory', |
| 52 group => $group, |
| 53 mode => 0750, |
| 54 owner => 'root', |
| 34 require => File[$adblockplus::directory], | 55 require => File[$adblockplus::directory], |
| 35 } | 56 } |
| 36 | 57 |
| 37 # Invoke realize(User[$adblockplus::log::user]) when necessary | 58 # Invoke realize(User[$adblockplus::log::user]) when necessary |
| 38 @user {$user: | 59 @user {$user: |
| 39 ensure => 'present', | 60 ensure => $ensure, |
| 40 managehome => true, | 61 managehome => true, |
| 62 groups => [$group], |
| 41 } | 63 } |
| 42 | 64 |
| 43 # See modules/adblockplus/manifests/log/rotation.pp | 65 # See modules/adblockplus/manifests/log/rotation.pp |
| 44 create_resources('adblockplus::log::rotation', $rotations) | 66 create_resources('adblockplus::log::rotation', $rotations) |
| 45 } | 67 } |
| OLD | NEW |