From: Andrew Schoen Date: Fri, 15 May 2015 21:12:20 +0000 (-0500) Subject: cobbler: adds a snippet to create post install kernel options. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=08c36e66eb0a35b5e24f1d3d0df782814a5cfba0;p=ceph-cm-ansible.git cobbler: adds a snippet to create post install kernel options. This snippet is used by the cephlab_preseed_late script to set the GRUB_CMDLINE_LINUX value in /etc/defaults/grub to what's defined by the system, profile or distro that's currently being imaged. Signed-off-by: Andrew Schoen --- diff --git a/roles/cobbler/templates/scripts/cephlab_preseed_late b/roles/cobbler/templates/scripts/cephlab_preseed_late index df410011..7f9180ef 100644 --- a/roles/cobbler/templates/scripts/cephlab_preseed_late +++ b/roles/cobbler/templates/scripts/cephlab_preseed_late @@ -2,6 +2,9 @@ # Start preseed_late_default # This script runs in the chroot /target by default $SNIPPET('post_install_network_config_deb') +# set kernel options as defined by the system, profile or distro +# in the Kernel Options (Post Install) field which populates the var kernel_options_post +$SNIPPET('cephlab_post_install_kernel_options') $SNIPPET('late_apt_repo_config') $SNIPPET('post_run_deb') $SNIPPET('download_config_files') diff --git a/roles/cobbler/templates/snippets/cephlab_post_install_kernel_options b/roles/cobbler/templates/snippets/cephlab_post_install_kernel_options new file mode 100644 index 00000000..8479cc92 --- /dev/null +++ b/roles/cobbler/templates/snippets/cephlab_post_install_kernel_options @@ -0,0 +1,12 @@ +## {{ ansible_managed }} +#if $getVar('kernel_options_post','') != '' +# Start post install kernel options update +if [ -f /etc/default/grub ]; then + # set GRUB_CMDLINE_LINUX + TMP_GRUB=\$(gawk 'match(\$0,/^GRUB_CMDLINE_LINUX="([^"]+)"/,a) {printf("%s\n",a[1])}' /etc/default/grub) + sed -i '/^GRUB_CMDLINE_LINUX=/d' /etc/default/grub + echo "GRUB_CMDLINE_LINUX=\"\$TMP_GRUB $kernel_options_post\"" >> /etc/default/grub + grub-mkconfig -o /boot/grub/grub.cfg +fi +# End post install kernel options update +#end if