Index: modules/filtermaster/manifests/init.pp |
=================================================================== |
new file mode 100755 |
--- /dev/null |
+++ b/modules/filtermaster/manifests/init.pp |
@@ -0,0 +1,160 @@ |
+class filtermaster { |
+ Cron { |
+ environment => ['MAILTO=ROOT', 'PYTHONPATH=/opt/sitescripts'], |
+ } |
+ |
+ class {'ssh': |
+ custom_configuration => 'Match User rsync |
+ AllowTcpForwarding no |
+ X11Forwarding no |
+ AllowAgentForwarding no |
+ GatewayPorts no |
+ ForceCommand rsync --server --sender -vltprz --delete-excluded --exclude CVS . /home/rsync/subscriptions/' |
+ } |
+ |
+ user {'rsync': |
+ ensure => present, |
+ comment => 'Filter list mirror user', |
+ home => '/home/rsync', |
+ managehome => true |
+ } |
+ |
+ file {'/home/rsync/.ssh': |
+ ensure => directory, |
+ require => User['rsync'], |
+ owner => rsync, |
+ mode => 0600 |
+ } |
+ |
+ file {'/home/rsync/.ssh/authorized_keys': |
+ ensure => file, |
+ require => [ |
+ File['/home/rsync/.ssh'], |
+ User['rsync'] |
+ ], |
+ owner => rsync, |
+ mode => 0600, |
+ source => 'puppet:///modules/filtermaster/authorized_keys' |
+ } |
+ |
+ file {'/etc/sitescripts': |
+ ensure => file, |
+ owner => root, |
+ mode => 0644, |
+ source => 'puppet:///modules/filtermaster/sitescripts' |
+ } |
+ |
+#donwload the repos |
+ |
+ class repo_download( $name ) { |
+ exec { "fetch_repo": |
+ command => "hg clone https://hg.adblockplus.org/${name} /home/rsync/subscription/${name}", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/${name}" |
+ } |
+ } |
+ |
+ class {'repo_download': |
+ name => "easylist" |
+ } |
+ |
+ class {'repo_download': |
+ name => "easylistgermany" |
+ } |
+ |
+# exec { "fetch_easylist": |
+# command => "hg clone https://hg.adblockplus.org/easylist /home/rsync/subscription/easylist", |
+# path => ["/usr/bin/", "/bin/"], |
+# require => Package['mercurial'], |
+# user => rsync, |
+# timeout => 0, |
+# onlyif => "test ! -d /home/rsync/subscription/easylist" |
+# } |
+ |
+# exec { "fetch_easylist_germany": |
+# command => "hg clone https://hg.adblockplus.org/easylistgermany /home/rsync/subscription/easylistgermany", |
+# path => ["/usr/bin/", "/bin/"], |
+# require => Package['mercurial'], |
+# user => rsync, |
+# timeout => 0, |
+# onlyif => "test ! -d /home/rsync/subscription/easylistgermany" |
+# } |
+ |
+ exec { "fetch_easylist_italy": |
+ command => "hg clone https://hg.adblockplus.org/easylistitaly /home/rsync/subscription/easylistitaly", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/easylistitaly" |
+ } |
+ |
+ exec { "fetch_easylist_combinations": |
+ command => "hg clone https://hg.adblockplus.org/easylistcombinations /home/rsync/subscription/easylistcombinations", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/easylistcombinations" |
+ } |
+ |
+ exec { "fetch_malwaredomains": |
+ command => "hg clone https://hg.adblockplus.org/malwaredomains /home/rsync/subscription/malwaredomains", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/malwaredomains" |
+ } |
+ |
+ exec { "fetch_ruadlist": |
+ command => "hg clone https://hg.adblockplus.org/ruadlist /home/rsync/subscription/ruadlist", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/ruadlist" |
+ } |
+ |
+ exec { "fetch_listefr": |
+ command => "hg clone https://hg.adblockplus.org/listefr /home/rsync/subscription/listefr", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/listefr" |
+ } |
+ |
+ exec { "fetch_exceptionrules": |
+ command => "hg clone https://hg.adblockplus.org/exceptionrules /home/rsync/subscription/exceptionrules", |
+ path => ["/usr/bin/", "/bin/"], |
+ require => Package['mercurial'], |
+ user => rsync, |
+ timeout => 0, |
+ onlyif => "test ! -d /home/rsync/subscription/exceptionrules" |
+ } |
+ |
+ cron {update_subscription: |
+ ensure => present, |
+ command => "python -m sitescripts.subscriptions.bin.updateSubscriptionDownloads 3>&1 1>/dev/null 2>&3 | perl -pe 's/^/\"[\" . scalar localtime() . \"] \"/e' >> /tmp/subscription_errors && chmod 666 /tmp/subscription_errors 2>/dev/null", |
+ user => rsync, |
+ require => [ |
+ User['rsync'] |
+ ], |
+ minute => '*/10' |
+ } |
+ |
+ cron {update_malware: |
+ ensure => present, |
+ command => "python -m sitescripts.subscriptions.bin.updateMalwareDomainsList", |
+ user => rsync, |
+ require => [ |
+ User['rsync'] |
+ ], |
+ hour => '*/6', |
+ minute => 15 |
+ } |
+} |