OLD | NEW |
1 class statsclient ( | 1 class statsclient { |
2 $log_path, | |
3 $custom_sitescriptsini_source = [], | |
4 ) { | |
5 | |
6 $sitescriptsini_source = flatten(['puppet:///modules/statsclient/sitescripts.i
ni', $custom_sitescriptsini_source]) | |
7 | |
8 user {'stats': | 2 user {'stats': |
9 ensure => present, | 3 ensure => present, |
10 home => '/home/stats', | 4 home => '/home/stats', |
11 managehome => true, | 5 managehome => true, |
12 } | 6 } |
13 | 7 |
14 file {'/home/stats/.ssh': | 8 file {'/home/stats/.ssh': |
15 ensure => directory, | 9 ensure => directory, |
16 owner => stats, | 10 owner => stats, |
17 mode => 0600, | 11 mode => 0600, |
18 require => User['stats'], | 12 require => User['stats'], |
19 } | 13 } |
20 | 14 |
21 file {'/home/stats/.ssh/authorized_keys': | 15 file {'/home/stats/.ssh/authorized_keys': |
22 ensure => present, | 16 ensure => present, |
23 owner => stats, | 17 owner => stats, |
24 mode => 0400, | 18 mode => 0400, |
25 source => 'puppet:///modules/private/stats-authorized_keys', | 19 source => 'puppet:///modules/private/stats-authorized_keys', |
26 } | 20 } |
27 | 21 |
28 class {'ssh': | 22 class {'ssh': |
29 custom_configuration => 'Match User stats | 23 custom_configuration => 'Match User stats |
30 AllowTcpForwarding no | 24 AllowTcpForwarding no |
31 X11Forwarding no | 25 X11Forwarding no |
32 AllowAgentForwarding no | 26 AllowAgentForwarding no |
33 GatewayPorts no | 27 GatewayPorts no |
34 ForceCommand cat /var/www/stats.json', | 28 ForceCommand (echo $SSH_ORIGINAL_COMMAND | grep -qv /) && cat "/var/log/
nginx/$SSH_ORIGINAL_COMMAND"', |
35 } | |
36 | |
37 class {'sitescripts': | |
38 sitescriptsini_source => $sitescriptsini_source, | |
39 } | |
40 | |
41 package {'pypy':} | |
42 | |
43 file {'/var/www/stats.json': | |
44 ensure => present, | |
45 owner => stats, | |
46 mode => 644, | |
47 } | |
48 | |
49 file {'/opt/cron_geoipdb_update.sh': | |
50 ensure => file, | |
51 owner => root, | |
52 mode => 0750, | |
53 source => 'puppet:///modules/statsclient/cron_geoipdb_update.sh', | |
54 } | 29 } |
55 | 30 |
56 cron {'mirrorstats': | 31 cron {'mirrorstats': |
57 ensure => present, | 32 ensure => absent, |
58 require => [ | |
59 User['stats'], | |
60 Package['pypy'], | |
61 Exec["fetch_sitescripts"] | |
62 ], | |
63 command => "gzip -cd ${log_path} | pypy -m sitescripts.stats.bin.logprocesso
r", | |
64 environment => ['MAILTO=admins@adblockplus.org,root', 'PYTHONPATH=/opt/sites
cripts'], | |
65 user => stats, | 33 user => stats, |
66 hour => 0, | |
67 minute => 25, | |
68 } | |
69 | |
70 cron {'geoipdb_update': | |
71 ensure => present, | |
72 require => File['/opt/cron_geoipdb_update.sh'], | |
73 command => '/opt/cron_geoipdb_update.sh', | |
74 environment => ['MAILTO=admins@adblockplus.org,root'], | |
75 user => root, | |
76 hour => 3, | |
77 minute => 15, | |
78 monthday => 3, | |
79 } | 34 } |
80 } | 35 } |
OLD | NEW |