init.pp 1.69 KB
Newer Older
Simon Josi's avatar
Simon Josi committed
1
2
3
4
5
6
7
8
9
10
11
12
#
# bash module
#
# Copyright 2008, admin(at)immerda.ch
# Copyright 2008, Puzzle ITC GmbH
# Marcel Härry haerry+puppet(at)puzzle.ch
# Simon Josi josi+puppet(at)puzzle.ch
#
# This program is free software; you can redistribute 
# it and/or modify it under the terms of the GNU 
# General Public License version 3 as published by 
# the Free Software Foundation.
Marcel Haerry's avatar
Marcel Haerry committed
13
#
Marcel Haerry's avatar
Marcel Haerry committed
14

Marcel Haerry's avatar
Marcel Haerry committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class bash {
    case $operatingsystem {
        openbsd: { include bash::openbsd }
        centos: { include bash::centos }
        default: { include bash::base }
    }
}

class bash::base {
    package{bash:
        ensure => present,
    }
}


class bash::centos inherits bash::base {
mh's avatar
mh committed
31
    package{ [ 'bash-completion', 'rootfiles']: 
Marcel Haerry's avatar
Marcel Haerry committed
32
33
        ensure => present,
    }
34
    bash::deploy_profile{bash_profile_root: source => 'centos' }
Marcel Haerry's avatar
Marcel Haerry committed
35
    include bash::timeout
Marcel Haerry's avatar
Marcel Haerry committed
36
37
38
}

class bash::openbsd inherits bash::base {
mh's avatar
mh committed
39
	package{'libiconv':
40
	    ensure => present,
mh's avatar
mh committed
41
	}
Marcel Haerry's avatar
Marcel Haerry committed
42

mh's avatar
mh committed
43
	package {'gettext':
mh's avatar
mh committed
44
        ensure => present,
mh's avatar
mh committed
45
46
		require => Package[libiconv],
	}
Marcel Haerry's avatar
Marcel Haerry committed
47
48

    Package[bash]{
mh's avatar
mh committed
49
        ensure => present,
Marcel Haerry's avatar
Marcel Haerry committed
50
51
52
53
54
55
56
57
        require => Package[gettext],
    }
    bash::deploy_profile{bash_profile_root: source => 'openbsd' }
}

define bash::deploy_profile(
    $source,
    $destination = '/root/.bash_profile',
Marcel Haerry's avatar
Marcel Haerry committed
58
59
    $uid = root,
    $gid = 0 ){
Marcel Haerry's avatar
Marcel Haerry committed
60

61
    file {$name:
Marcel Haerry's avatar
Marcel Haerry committed
62
63
64
65
                path => $destination,
                owner => $uid,
                group => $gid,
                mode => 600,
66
67
68
69
70
71
                source =>   [
                    "puppet://$server/files/bash/${fqdn}/${source}",
                    "puppet://$server/files/bash/${source}",
                    "puppet://$server/bash/module/${source}",
                    "puppet://$server/bash/${source}"
                ],
Marcel Haerry's avatar
Marcel Haerry committed
72
73
        }
}