diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-29 14:11:21 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-29 14:11:21 +0200 |
commit | 4234a2882f0812be37721b6b7a58156260d52379 (patch) | |
tree | 9394eba47021a7050c7764b7fed0689d5a15b6fa /grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel | |
download | grid5k-4234a2882f0812be37721b6b7a58156260d52379.tar.gz grid5k-4234a2882f0812be37721b6b7a58156260d52379.tar.bz2 grid5k-4234a2882f0812be37721b6b7a58156260d52379.zip |
initial import
Diffstat (limited to 'grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel')
4 files changed, 125 insertions, 0 deletions
diff --git a/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/initramfs.pp b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/initramfs.pp new file mode 100644 index 0000000..720a714 --- /dev/null +++ b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/initramfs.pp @@ -0,0 +1,8 @@ +class env::min::kernel::initramfs { + + exec { + 'generate_initramfs': + command => "/usr/sbin/update-initramfs -u -k all", + refreshonly => true; + } +} diff --git a/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/modules.pp b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/modules.pp new file mode 100644 index 0000000..47e5cbe --- /dev/null +++ b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/modules.pp @@ -0,0 +1,52 @@ +class env::min::kernel::modules { + + # Blacklist modules + file { + '/etc/modprobe.d/blacklist.conf': + ensure => 'file', + } + augeas { + 'blacklist_nouveau': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] nouveau",], + onlyif =>"match blacklist[.='nouveau'] size == 0 "; + 'blacklist_myri10ge': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] myri10ge",], + onlyif =>"match blacklist[.='myri10ge'] size == 0 "; + 'blacklist_usb_storage': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] usb_storage",], + onlyif =>"match blacklist[.='usb_storage'] size == 0 "; + 'blacklist_usbhid': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] usbhid",], + onlyif =>"match blacklist[.='usbhid'] size == 0 "; + 'blacklist_ohci_hcd': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] ohci_hcd",], + onlyif =>"match blacklist[.='ohci_hcd'] size == 0 "; + 'blacklist_ehci_hcd': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] ehci_hcd",], + onlyif =>"match blacklist[.='ehci_hcd'] size == 0 "; + 'blacklist_usbcore': + context => "/files/etc/modprobe.d/blacklist.conf", + tag => "modules", + changes =>["set blacklist[last()+1] usbcore",], + onlyif =>"match blacklist[.='usbcore'] size == 0 "; + + } + + # Retrieve all modules tag and regenerate initramfs + # This allow another manifest to modify blacklist.conf + # or another blacklist file and benefit from this refresh. + # It only needs to tag Augeas with 'modules' tag. + Augeas <| tag == "modules" |> ~> Exec['generate_initramfs'] +} diff --git a/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/remove_old.pp b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/remove_old.pp new file mode 100644 index 0000000..15118e2 --- /dev/null +++ b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/remove_old.pp @@ -0,0 +1,17 @@ +class env::min::kernel::remove_old { + # Remove the current kernel if it's not the last one + if $kernelrelease != $installed_kernelreleases[-1] { + package { "linux-image-$kernelrelease": + ensure => 'purged' + } + + file { + "/lib/modules/$kernelrelease": + ensure => absent, + force => true; + "/usr/lib/modules/$kernelrelease": + ensure => absent, + force => true; + } + } +} diff --git a/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/setup_links.pp b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/setup_links.pp new file mode 100644 index 0000000..66f2074 --- /dev/null +++ b/grid5000/steps/data/setup/puppet/modules/env/manifests/min/kernel/setup_links.pp @@ -0,0 +1,48 @@ +class env::min::kernel::setup_links { + # Ensure the kernel symlink will be installed in / + file_line { + '/etc/kernel-img.conf: update kernel symlink behavior to link in /': + path => '/etc/kernel-img.conf', + line => "link_in_boot = no", + match => '^link_in_boot =', + before => [ + Exec['linux-update-symlinks-vmlinuz'], + Exec['linux-update-symlinks-vmlinux'], + ]; + } + + # Ensure symlinks to /boot are removed + file { + '/boot/vmlinuz': + path => '/boot/vmlinuz', + ensure => absent; + '/boot/vmlinuz.old': + path => '/boot/vmlinuz.old', + ensure => absent; + '/boot/vmlinux': + path => '/boot/vmlinux', + ensure => absent; + '/boot/vmlinux.old': + path => '/boot/vmlinux.old', + ensure => absent; + '/boot/initrd.img': + path => '/boot/initrd.img', + ensure => absent; + '/boot/initrd.img.old': + path => '/boot/initrd.img.old', + ensure => absent; + } + + # Setup symlink for initrd and vmlinuz/vmlinux + exec { + 'linux-update-symlinks-vmlinuz': + onlyif => "/usr/bin/test -e /boot/vmlinuz-${kernelrelease}", + command => "/usr/bin/linux-update-symlinks install ${kernelrelease} /boot/vmlinuz-${kernelrelease}"; + } + exec { + 'linux-update-symlinks-vmlinux': + onlyif => "/usr/bin/test -e /boot/vmlinux-${kernelrelease}", + command => "/usr/bin/linux-update-symlinks install ${kernelrelease} /boot/vmlinux-${kernelrelease}"; + } + +} |