aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mirror_cleaner/manifests/init.pp
blob: 77ba1c8830baf626609f828127f423567ddd9635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class mirror_cleaner {
    class base {
        file { "/usr/local/bin/orphans_cleaner.pl":
             ensure => present,
             owner => root,
             group => root,
             mode => 755,
             source => 'puppet:///modules/mirror_cleaner/orphans_cleaner.pl',
        }
    }

    define orphans($base) {
        include mirror_cleaner::base

        $orphan_dir = "/distrib/archive/orphans"

        file { $orphan_dir:
            ensure => directory
        }

        cron { "clean orphans $name":
            command => "/usr/local/bin/orphans_cleaner.pl $base/$name $orphan_dir",
            hour => 5,
            minute => 30,
            user => root,
        }

        tidy { $orphan_dir:
            age => "4w",
            recurse => true,
            matches => ["*.rpm"],
        }
    }
}