Merge branch 'master' of git+ssh://puppet.debian.org/srv/puppet.debian.org/git/dsa...
[mirror/dsa-puppet.git] / modules / debian-org / manifests / init.pp
1 define sysctl($key, $value, $ensure=present) {
2     file {
3         "/etc/sysctl.d/$name.conf":
4             ensure  => $ensure,
5             owner   => root,
6             group   => root,
7             mode    => 0644,
8             content => "$key = $value\n",
9             notify  => Exec["procps restart"],
10     }
11 }
12
13 define set_alternatives($linkto) {
14     exec {
15         "/usr/sbin/update-alternatives --set $name $linkto":
16             unless => "/bin/sh -c '! [ -e $linkto ] || ! [ -e /etc/alternatives/$name ] || ([ -L /etc/alternatives/$name ] && [ /etc/alternatives/$name -ef $linkto ])'"
17         }
18 }
19
20
21 class debian-org {
22     package {
23         "apt-utils": ensure => installed;
24         "bash-completion": ensure => installed;
25         "bzip2": ensure => installed;
26         "cron": ensure => installed;
27         "csh": ensure => installed;
28         "dnsutils": ensure => installed;
29         "dsa-munin-plugins": ensure => installed;
30         "ed": ensure => installed;
31         "gnupg": ensure => installed;
32         "klogd": ensure => purged;
33         "ksh": ensure => installed;
34         "less": ensure => installed;
35         "libfilesystem-ruby1.8": ensure => installed;
36         "libpam-pwdfile": ensure => installed;
37         "locales-all": ensure => installed;
38         "mtr-tiny": ensure => installed;
39         "nload": ensure => installed;
40         "pciutils": ensure => installed;
41         "pdksh": ensure => installed;
42         "rsyslog": ensure => purged;
43         "sysklogd": ensure => purged;
44         "syslog-ng": ensure => installed;
45         "tcsh": ensure => installed;
46         "userdir-ldap": ensure => installed;
47         "vim": ensure => installed;
48         "zsh": ensure => installed;
49         "logrotate": ensure => installed;
50     }
51     file {
52         "/etc/apt/preferences":
53             source => "puppet:///modules/debian-org/apt.preferences";
54         "/etc/apt/sources.list.d/backports.org.list":
55             content => template("debian-org/etc/apt/sources.list.d/backports.org.list.erb"),
56             notify  => Exec["apt-get update"];
57         "/etc/apt/sources.list.d/debian.org.list":
58             content => template("debian-org/etc/apt/sources.list.d/debian.org.list.erb"),
59             notify  => Exec["apt-get update"];
60         "/etc/apt/sources.list.d/security.list":
61             content => template("debian-org/etc/apt/sources.list.d/security.list.erb"),
62             notify  => Exec["apt-get update"];
63         "/etc/apt/sources.list.d/volatile.list":
64             content => template("debian-org/etc/apt/sources.list.d/volatile.list.erb"),
65             notify  => Exec["apt-get update"];
66         "/etc/apt/apt.conf.d/local-recommends":
67             source => "puppet:///modules/debian-org/apt.conf.d/local-recommends";
68         "/etc/apt/apt.conf.d/local-pdiffs":
69             source => "puppet:///modules/debian-org/apt.conf.d/local-pdiffs";
70         "/etc/timezone":
71             source => "puppet:///modules/debian-org/timezone",
72             notify => Exec["dpkg-reconfigure tzdata -pcritical -fnoninteractive"];
73         "/etc/puppet/puppet.conf":
74             # require => Package["puppet"],
75             source => "puppet:///modules/debian-org/puppet.conf"
76             ;
77         "/etc/default/puppet":
78             # require => Package["puppet"],
79             source => "puppet:///modules/debian-org/puppet.default"
80             ;
81
82         "/etc/cron.d/dsa-puppet-stuff":
83             source => "puppet:///modules/debian-org/dsa-puppet-stuff.cron",
84             require => Package["cron"]
85             ;
86         "/etc/ldap/ldap.conf":
87             require => Package["userdir-ldap"],
88             source => "puppet:///modules/debian-org/ldap.conf",
89             ;
90         "/etc/pam.d/common-session":
91             require => Package["libpam-pwdfile"],
92             source => "puppet:///modules/debian-org/pam.common-session",
93             ;
94         "/etc/rc.local":
95             mode   => 0755,
96             source => "puppet:///modules/debian-org/rc.local",
97             notify => Exec["rc.local start"],
98             ;
99     }
100     case $hostname {
101         handel: {
102             file {
103                 "/etc/puppet/lib":
104                     ensure  => directory,
105                     source => "puppet:///files/etc/puppet/lib",
106                     recurse => true,
107                     notify  => Exec["puppetmaster restart"];
108              }
109          }
110     }
111    
112     # set mmap_min_addr to 4096 to mitigate
113     # Linux NULL-pointer dereference exploits
114     sysctl {
115         "mmap_min_addr" :
116             key         => "vm.mmap_min_addr",
117             value       => 4096,
118     }
119    
120     set_alternatives {
121         "editor":
122             linkto => "/usr/bin/vim.basic",
123     }
124    
125     exec {
126         "dpkg-reconfigure tzdata -pcritical -fnoninteractive":
127             path        => "/usr/bin:/usr/sbin:/bin:/sbin",
128             refreshonly => true;
129         "apt-get update":
130             command => 'apt-get update',
131             path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
132             refreshonly => true;
133         "puppetmaster restart":
134             path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
135             refreshonly => true;
136         "rc.local start":
137             path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
138             refreshonly => true;
139         "procps restart":
140             path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
141             refreshonly => true;
142         "init q":
143             refreshonly => true;
144     }
145 }
146
147 class debian-proliant inherits debian-org {
148     package {
149         "hpacucli": ensure => installed;
150         "hp-health": ensure => installed;
151         "cpqarrayd": ensure => installed;
152         "arrayprobe": ensure => installed;
153     }
154     case $debarchitecture {
155         "amd64": {
156             package { "lib32gcc1": ensure => installed; }
157         }
158     }
159     file {
160         "/etc/apt/sources.list.d/debian.restricted.list":
161             content => template("debian-org/etc/apt/sources.list.d/debian.restricted.list.erb"),
162             notify  => Exec["apt-get update"];
163     }
164 }
165 # vim:set et:
166 # vim:set sts=4 ts=4:
167 # vim:set shiftwidth=4: