Configure ubc blade grub with puppet
authorPeter Palfrader <peter@palfrader.org>
Thu, 17 Aug 2017 18:19:15 +0000 (18:19 +0000)
committerPeter Palfrader <peter@palfrader.org>
Thu, 17 Aug 2017 18:19:15 +0000 (18:19 +0000)
modules/grub/manifests/init.pp
modules/grub/templates/puppet-kernel-nopat.cfg.erb [new file with mode: 0644]

index 1ef9ec7..7e41b62 100644 (file)
@@ -1,25 +1,49 @@
 class grub {
        if ($::kernel == 'Linux' and $::is_virtual and $::virtual == 'kvm') {
+               $grub_manage = true
+               $grub_do_serial = true
+               $grub_do_ifnames = true
+       } elsif $::hostname in [ubc-enc2bl01,ubc-enc2bl02,ubc-enc2bl09,ubc-enc2bl10] {
+               $grub_manage = true
+               $grub_do_serial = true
+               $grub_do_nopat = true
+       } else {
+               $grub_manage = false
+       }
+
+
+       if $grub_manage {
                file { '/etc/default/grub':
                        # restore to default
                        source => 'puppet:///modules/grub/etc-default-grub',
                        notify  => Exec['update-grub']
                }
+
                file { '/etc/default/grub.d':
                        ensure => directory
                }
+
                file { '/etc/default/grub.d/puppet-grub-serial.cfg':
+                       ensure => $grub_do_serial ? { true  => 'present', default => 'absent' },
                        content  => template('grub/puppet-grub-serial.cfg.erb'),
                        notify  => Exec['update-grub']
                }
+
                file { '/etc/default/grub.d/puppet-net-ifnames.cfg':
+                       ensure => $grub_do_ifnames ? { true  => 'present', default => 'absent' },
                        content  => template('grub/puppet-net-ifnames.cfg.erb'),
                        notify  => Exec['update-grub']
                }
 
-               exec { 'update-grub':
-                       refreshonly => true,
-                       path        => '/usr/bin:/usr/sbin:/bin:/sbin',
+               file { '/etc/default/grub.d/puppet-kernel-nopat.cfg':
+                       ensure => $grub_do_nopat ? { true  => 'present', default => 'absent' },
+                       content  => template('grub/puppet-kernel-nopat.cfg.erb'),
+                       notify  => Exec['update-grub']
                }
        }
+
+       exec { 'update-grub':
+               refreshonly => true,
+               path        => '/usr/bin:/usr/sbin:/bin:/sbin',
+       }
 }
diff --git a/modules/grub/templates/puppet-kernel-nopat.cfg.erb b/modules/grub/templates/puppet-kernel-nopat.cfg.erb
new file mode 100644 (file)
index 0000000..c38d891
--- /dev/null
@@ -0,0 +1 @@
+GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX nopat"