init.pp 2 KB
Newer Older
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.
mh's avatar
mh committed
13
14
#

mh's avatar
mh committed
15
#modules_dir { "bash": }
mh's avatar
mh committed
16
17

class bash {
mh's avatar
mh committed
18
19
20
21
22
23
    case $operatingsystem {
        openbsd: { include bash::openbsd }
        centos: { include bash::centos }
        default: { include bash::base }
    }
}
mh's avatar
mh committed
24

mh's avatar
mh committed
25
26
27
28
29
30
31
32
class bash::base {
    package{bash:
        ensure => present,
    }
}


class bash::centos inherits bash::base {
mh's avatar
mh committed
33
    package{ [ 'bash-completion', 'rootfiles']: :
mh's avatar
mh committed
34
35
        ensure => present,
    }
36
    bash::deploy_profile{bash_profile_root: source => 'centos' }
mh's avatar
mh committed
37
38
39
40
41
}

class bash::openbsd inherits bash::base {

	package{'libiconv':
42
	    ensure => present,
mh's avatar
mh committed
43
		source => 'ftp://mirror.switch.ch/pub/OpenBSD/${operatingsystemrelease}/packages/${hardwaremodel}/',
mh's avatar
mh committed
44
45
46
	}

	package {'gettext':
mh's avatar
mh committed
47
48
        ensure => present,
		source => 'ftp://mirror.switch.ch/pub/OpenBSD/${operatingsystemrelease}/packages/${hardwaremodel}/',
mh's avatar
mh committed
49
50
		require => Package[libiconv],
	}
51

mh's avatar
mh committed
52
    Package[bash]{
mh's avatar
mh committed
53
54
        ensure => present,
		source => 'ftp://mirror.switch.ch/pub/OpenBSD/${operatingsystemrelease}/packages/${hardwaremodel}/',
mh's avatar
mh committed
55
56
57
        require => Package[gettext],
    }
    bash::deploy_profile{bash_profile_root: source => 'openbsd' }
mh's avatar
mh committed
58
59
}

60
61
62
63
64
define bash::deploy_profile(
    $source,
    $destination = '/root/.bash_profile',
    $uid = 'root',
    $gid = '0' ){
mh's avatar
mh committed
65

66
    file {$name:
mh's avatar
mh committed
67
                path => $destination,
mh's avatar
mh committed
68
69
70
                owner => $uid,
                group => $gid,
                mode => 600,
71
72
73
74
75
76
                source =>   [
                    "puppet://$server/files/bash/${fqdn}/${source}",
                    "puppet://$server/files/bash/${source}",
                    "puppet://$server/bash/module/${source}",
                    "puppet://$server/bash/${source}"
                ],
mh's avatar
mh committed
77
78
        }
}