grub: nopat on villa
[mirror/dsa-puppet.git] / modules / grub / manifests / init.pp
1 class grub {
2         $grub_do_ifnames = ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm')
3
4         if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm') {
5                 $grub_manage = true
6                 $grub_do_kernel_serial = true
7                 $grub_do_grub_serial = true
8         } elsif $::hostname in [ubc-enc2bl01,ubc-enc2bl02,ubc-enc2bl09,ubc-enc2bl10,casulana,mirror-anu,sallinen,storace,mirror-accumu,bm-bl1,bm-bl2,bm-bl3,bm-bl4,bm-bl5,bm-bl6,bm-bl7,bm-bl8,bm-bl9,bm-bl10,bm-bl11,bm-bl12,bm-bl13,bm-bl14] {
9                 $grub_manage = true
10                 $grub_do_kernel_serial = true
11                 $grub_do_grub_serial = true
12         } elsif $::hostname in [mirror-skroutz,aagaard,acker,arm-arm-01,fasolo] {
13                 $grub_manage = true
14                 $grub_do_kernel_serial = true
15                 $grub_do_grub_serial = true
16         } elsif $::hostname in [acker,arm-arm-03] {
17                 $grub_manage = true
18                 $grub_do_kernel_serial = true
19                 $grub_do_grub_serial = false
20         } else {
21                 $grub_manage = false
22         }
23
24         $grub_do_nopat = $::hostname in [ubc-enc2bl01,ubc-enc2bl02,ubc-enc2bl09,ubc-enc2bl10,casulana,mirror-anu,sallinen,storace,mirror-accumu,bm-bl1,bm-bl2,bm-bl3,bm-bl4,bm-bl5,bm-bl6,bm-bl7,bm-bl8,bm-bl9,bm-bl10,bm-bl11,bm-bl12,bm-bl13,bm-bl14,villa]
25         $grub_do_extra = $::hostname in [fasolo]
26
27         if $grub_manage {
28                 file { '/etc/default/grub':
29                         # restore to default
30                         source => 'puppet:///modules/grub/etc-default-grub',
31                         notify  => Exec['update-grub']
32                 }
33
34                 file { '/etc/default/grub.d':
35                         ensure => directory,
36                         mode   => '0555',
37                         purge   => true,
38                         force   => true,
39                         recurse => true,
40                         source  => 'puppet:///files/empty/',
41                 }
42
43                 file { '/etc/default/grub.d/puppet-grub-serial.cfg':
44                         ensure => $grub_do_kernel_serial ? { true  => 'present', default => 'absent' },
45                         content  => template('grub/puppet-grub-serial.cfg.erb'),
46                         notify  => Exec['update-grub']
47                 }
48
49                 file { '/etc/default/grub.d/puppet-kernel-serial.cfg':
50                         ensure => $grub_do_grub_serial ? { true  => 'present', default => 'absent' },
51                         content  => template('grub/puppet-kernel-serial.cfg.erb'),
52                         notify  => Exec['update-grub']
53                 }
54
55                 file { '/etc/default/grub.d/puppet-net-ifnames.cfg':
56                         ensure => $grub_do_ifnames ? { true  => 'present', default => 'absent' },
57                         content  => template('grub/puppet-net-ifnames.cfg.erb'),
58                         notify  => Exec['update-grub']
59                 }
60
61                 file { '/etc/default/grub.d/puppet-kernel-nopat.cfg':
62                         ensure => $grub_do_nopat ? { true  => 'present', default => 'absent' },
63                         content  => template('grub/puppet-kernel-nopat.cfg.erb'),
64                         notify  => Exec['update-grub']
65                 }
66
67                 file { '/etc/default/grub.d/puppet-kernel-extra.cfg':
68                         ensure => $grub_do_extra ? { true  => 'present', default => 'absent' },
69                         content  => template('grub/puppet-kernel-extra.cfg.erb'),
70                         notify  => Exec['update-grub']
71                 }
72         }
73
74         exec { 'update-grub':
75                 refreshonly => true,
76                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
77         }
78 }