summaryrefslogtreecommitdiff
path: root/manifests/setup.pp
blob: 2c1d34396dc470f792bfd98015c437cb9377780f (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
35
36
37
38
39
40
41
# Sets up the concat system.
#
# $concatdir should point to a place where you wish the fragments to
# live. This should not be somewhere like /tmp since ideally these files
# should not be deleted ever, puppet should always manage them
#
# $puppetversion should be either 24 or 25 to enable a 24 compatible
# mode, in 24 mode you might see phantom notifies this is a side effect
# of the method we use to clear the fragments directory.
# 
# The regular expression below will try to figure out your puppet version
# but this code will only work in 0.24.8 and newer.
#
# It also copies out the concatfragments.sh file to /usr/local/bin
class concat::setup {
    $id = $::id
    $root_group = $id ? {
      root => 0,
      default => $id
    }
    $concatdir = $::concat_basedir
    $majorversion = regsubst($::puppetversion, '^[0-9]+[.]([0-9]+)[.][0-9]+$', '\1')

    file{"${concatdir}/bin/concatfragments.sh":
            owner  => $id,
            group  => $root_group,
            mode   => 755,
            source => $majorversion ? {
                        24      => "puppet:///concat/concatfragments.sh",
                        default => "puppet:///modules/concat/concatfragments.sh"
                      };

         [ $concatdir, "${concatdir}/bin" ]:
            ensure => directory,
            owner  => $id,
            group  => $root_group,
            mode   => '0750';
    }
}

# vi:tabstop=4:expandtab:ai