LEFT | RIGHT |
1 class filtermaster { | 1 class filtermaster { |
2 Cron { | 2 Cron { |
3 environment => ['MAILTO=ROOT', 'PYTHONPATH=/opt/sitescripts'], | 3 #TODO change email |
| 4 environment => ['MAILTO=root', 'PYTHONPATH=/opt/sitescripts'], |
4 } | 5 } |
5 » | 6 |
6 class {'ssh': | 7 class {'ssh': |
7 custom_configuration => 'Match User rsync | 8 custom_configuration => 'Match User rsync |
8 AllowTcpForwarding no | 9 AllowTcpForwarding no |
9 X11Forwarding no | 10 X11Forwarding no |
10 AllowAgentForwarding no | 11 AllowAgentForwarding no |
11 GatewayPorts no | 12 GatewayPorts no |
12 ForceCommand rsync --server --sender -vltprz --delete-excluded --exclude CVS
. /home/rsync/subscriptions/' | 13 ForceCommand rsync --server --sender -vltprz --delete-excluded . /home/rsync
/generated/data/' |
13 } | 14 } |
14 | 15 |
15 user {'rsync': | 16 user {'rsync': |
16 ensure => present, | 17 ensure => present, |
17 comment => 'Filter list mirror user', | 18 comment => 'Filter list mirror user', |
18 home => '/home/rsync', | 19 home => '/home/rsync', |
19 managehome => true | 20 managehome => true |
20 } | 21 } |
21 » | 22 |
| 23 file {'/home/rsync/update_repos.sh': |
| 24 ensure => file, |
| 25 owner => rsync, |
| 26 mode => 0700, |
| 27 source => 'puppet:///modules/filtermaster/update_repos.sh' |
| 28 } |
| 29 |
| 30 file {'/home/rsync/subscription': |
| 31 ensure => directory, |
| 32 owner => rsync |
| 33 } |
| 34 |
| 35 file {'/home/rsync/generated': |
| 36 ensure => directory, |
| 37 owner => rsync |
| 38 } |
| 39 |
22 file {'/home/rsync/.ssh': | 40 file {'/home/rsync/.ssh': |
23 ensure => directory, | 41 ensure => directory, |
24 require => User['rsync'], | |
25 owner => rsync, | 42 owner => rsync, |
26 mode => 0600 | 43 mode => 0600 |
27 } | 44 } |
28 » | 45 |
29 file {'/home/rsync/.ssh/authorized_keys': | 46 file {'/home/rsync/.ssh/authorized_keys': |
30 ensure => file, | 47 ensure => file, |
31 require => [ | |
32 File['/home/rsync/.ssh'], | |
33 User['rsync'] | |
34 ], | |
35 owner => rsync, | 48 owner => rsync, |
36 mode => 0600, | 49 mode => 0600, |
37 source => 'puppet:///modules/filtermaster/authorized_keys' | 50 source => 'puppet:///modules/private/rsync@easylist-downloads.adblockplus.or
g.pub' |
38 } | 51 } |
39 | 52 |
40 file {'/etc/sitescripts': | 53 file {'/etc/ssh/ssh_host_rsa_key': |
| 54 require => Package['openssh-server'], |
| 55 notify => Service['ssh'], |
41 ensure => file, | 56 ensure => file, |
42 owner => root, | 57 owner => root, |
43 mode => 0644, | 58 group => root, |
44 source => 'puppet:///modules/filtermaster/sitescripts' | 59 source => 'puppet:///modules/private/filtermaster.adblockplus.org_ssh.key' |
45 } | 60 } |
46 | 61 |
47 #donwload the repos | 62 file {'/etc/ssh/ssh_host_rsa_key.pub': |
| 63 require => Package['openssh-server'], |
| 64 notify => Service['ssh'], |
| 65 ensure => file, |
| 66 owner => root, |
| 67 group => root, |
| 68 source => 'puppet:///modules/private/filtermaster.adblockplus.org_ssh.pub' |
| 69 } |
48 | 70 |
49 class repo_download( $name ) { | 71 package {['p7zip-full']:} |
50 exec { "fetch_repo": | 72 |
51 command => "hg clone https://hg.adblockplus.org/${name} /home/rsync/subsc
ription/${name}", | 73 define repo_download() { |
| 74 exec {"fetch_${title}": |
| 75 command => "hg clone https://hg.adblockplus.org/${title} /home/rsync/subsc
ription/${title}", |
52 path => ["/usr/bin/", "/bin/"], | 76 path => ["/usr/bin/", "/bin/"], |
53 require => Package['mercurial'], | 77 require => Package['mercurial'], |
54 user => rsync, | 78 user => rsync, |
55 timeout => 0, | 79 timeout => 0, |
56 onlyif => "test ! -d /home/rsync/subscription/${name}" | 80 onlyif => "test ! -d /home/rsync/subscription/${title}" |
57 } | 81 } |
58 } | 82 } |
59 | 83 |
60 class {'repo_download': | 84 repo_download {['easylist', |
61 name => "easylist" | 85 'easylistgermany', |
| 86 'easylistitaly', |
| 87 'easylistcombinations', |
| 88 'malwaredomains', |
| 89 'ruadlist', |
| 90 'listefr', |
| 91 'exceptionrules', |
| 92 'easylistdutch', |
| 93 'facebookfilters', |
| 94 'antiadblockfilters' |
| 95 ]: |
62 } | 96 } |
63 | 97 |
64 class {'repo_download': | 98 cron {'update_subscription': |
65 name => "easylistgermany" | 99 ensure => present, |
| 100 command => "python -m sitescripts.subscriptions.bin.updateSubscriptionDownlo
ads 3>&1 1>/dev/null 2>&3 | perl -pe 's/^/\"[\" . scalar localtime() . \"] \"/e'
>> /tmp/subscription_errors && chmod 666 /tmp/subscription_errors 2>/dev/null", |
| 101 user => rsync, |
| 102 require => User['rsync'], |
| 103 minute => '*/10' |
| 104 } |
| 105 |
| 106 cron {'update_malware': |
| 107 ensure => present, |
| 108 command => "python -m sitescripts.subscriptions.bin.updateMalwareDomainsList
", |
| 109 user => rsync, |
| 110 require => User['rsync'], |
| 111 hour => '*/6', |
| 112 minute => 15 |
| 113 } |
| 114 |
| 115 cron {'update_repos': |
| 116 ensure => present, |
| 117 command => "/home/rsync/update_repos.sh", |
| 118 user => rsync, |
| 119 require => [ |
| 120 User['rsync'], |
| 121 File['/home/rsync/update_repos.sh'] |
| 122 ], |
| 123 minute => '8-58/10' |
66 } | 124 } |
67 | 125 |
68 # exec { "fetch_easylist": | 126 class {'sitescripts': |
69 # command => "hg clone https://hg.adblockplus.org/easylist /home/rsync/subscr
iption/easylist", | 127 sitescriptsini_source => 'puppet:///modules/filtermaster/sitescripts' |
70 # path => ["/usr/bin/", "/bin/"], | |
71 # require => Package['mercurial'], | |
72 # user => rsync, | |
73 # timeout => 0, | |
74 # onlyif => "test ! -d /home/rsync/subscription/easylist" | |
75 # } | |
76 » | |
77 # exec { "fetch_easylist_germany": | |
78 # command => "hg clone https://hg.adblockplus.org/easylistgermany /home/rsync
/subscription/easylistgermany", | |
79 # path => ["/usr/bin/", "/bin/"], | |
80 # require => Package['mercurial'], | |
81 # user => rsync, | |
82 # timeout => 0, | |
83 # onlyif => "test ! -d /home/rsync/subscription/easylistgermany" | |
84 # } | |
85 | |
86 exec { "fetch_easylist_italy": | |
87 command => "hg clone https://hg.adblockplus.org/easylistitaly /home/rsync/su
bscription/easylistitaly", | |
88 path => ["/usr/bin/", "/bin/"], | |
89 require => Package['mercurial'], | |
90 user => rsync, | |
91 timeout => 0, | |
92 onlyif => "test ! -d /home/rsync/subscription/easylistitaly" | |
93 } | |
94 | |
95 exec { "fetch_easylist_combinations": | |
96 command => "hg clone https://hg.adblockplus.org/easylistcombinations /home/r
sync/subscription/easylistcombinations", | |
97 path => ["/usr/bin/", "/bin/"], | |
98 require => Package['mercurial'], | |
99 user => rsync, | |
100 timeout => 0, | |
101 onlyif => "test ! -d /home/rsync/subscription/easylistcombinations" | |
102 } | |
103 | |
104 exec { "fetch_malwaredomains": | |
105 command => "hg clone https://hg.adblockplus.org/malwaredomains /home/rsync/s
ubscription/malwaredomains", | |
106 path => ["/usr/bin/", "/bin/"], | |
107 require => Package['mercurial'], | |
108 user => rsync, | |
109 timeout => 0, | |
110 onlyif => "test ! -d /home/rsync/subscription/malwaredomains" | |
111 } | |
112 | |
113 exec { "fetch_ruadlist": | |
114 command => "hg clone https://hg.adblockplus.org/ruadlist /home/rsync/subscri
ption/ruadlist", | |
115 path => ["/usr/bin/", "/bin/"], | |
116 require => Package['mercurial'], | |
117 user => rsync, | |
118 timeout => 0, | |
119 onlyif => "test ! -d /home/rsync/subscription/ruadlist" | |
120 } | 128 } |
121 | 129 } |
122 exec { "fetch_listefr": | |
123 command => "hg clone https://hg.adblockplus.org/listefr /home/rsync/subscrip
tion/listefr", | |
124 path => ["/usr/bin/", "/bin/"], | |
125 require => Package['mercurial'], | |
126 user => rsync, | |
127 timeout => 0, | |
128 onlyif => "test ! -d /home/rsync/subscription/listefr" | |
129 } | |
130 | |
131 exec { "fetch_exceptionrules": | |
132 command => "hg clone https://hg.adblockplus.org/exceptionrules /home/rsync/s
ubscription/exceptionrules", | |
133 path => ["/usr/bin/", "/bin/"], | |
134 require => Package['mercurial'], | |
135 user => rsync, | |
136 timeout => 0, | |
137 onlyif => "test ! -d /home/rsync/subscription/exceptionrules" | |
138 } | |
139 | |
140 cron {update_subscription: | |
141 ensure => present, | |
142 command => "python -m sitescripts.subscriptions.bin.updateSubscriptionDownlo
ads 3>&1 1>/dev/null 2>&3 | perl -pe 's/^/\"[\" . scalar localtime() . \"] \"/e'
>> /tmp/subscription_errors && chmod 666 /tmp/subscription_errors 2>/dev/null", | |
143 user => rsync, | |
144 require => [ | |
145 User['rsync'] | |
146 ], | |
147 minute => '*/10' | |
148 } | |
149 » » | |
150 cron {update_malware: | |
151 ensure => present, | |
152 command => "python -m sitescripts.subscriptions.bin.updateMalwareDomainsList
", | |
153 user => rsync, | |
154 require => [ | |
155 User['rsync'] | |
156 ], | |
157 hour => '*/6', | |
158 minute => 15 | |
159 } | |
160 }» | |
LEFT | RIGHT |