]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Write exact /etc/default/grub
authorDavid Galloway <dgallowa@redhat.com>
Fri, 9 Mar 2018 19:58:08 +0000 (14:58 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 21 Mar 2018 15:58:38 +0000 (11:58 -0400)
This fixes console output during Xenial and later.  Prior to this, the
Plymouth boot screen would get loaded and "[37mUbuntu 16.04[-1;-1f[33m.
[37m.  [37m.  [37m." would get repeated to the console until the login
prompt shows up.

Writing our own file instead of finding and replacing variables makes
sure the settings are exactly what we want.

This snippet is only used on Debian-based distros.  The default Cobbler
snippet is used on RPM-based distros.

Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/cobbler/templates/snippets/cephlab_post_install_kernel_options
roles/testnode/README.rst
roles/testnode/files/scripts/kernel_logging.sh [deleted file]
roles/testnode/tasks/setup-ubuntu-non-aarch64.yml

index 8479cc925da79099d76282556b77ec3f6fc7d32e..338b856a5e4e89fae5489b7cd09f16a979339baa 100644 (file)
@@ -1,12 +1,18 @@
 ## {{ 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
+cat > /etc/default/grub <<-EOF
+       # {{ ansible_managed }}
+       GRUB_DEFAULT=0
+       GRUB_TIMEOUT=5
+       GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
+       GRUB_CMDLINE_LINUX_DEFAULT=""
+       GRUB_TERMINAL="console"
+       GRUB_SERIAL_COMMAND="console --unit=1 --speed=115200 --stop=1"
+#if $getVar('kernel_options_post','') != ''
+       GRUB_CMDLINE_LINUX="$kernel_options_post"
+#else
+       GRUB_CMDLINE_LINUX="console=tty0"
 #end if
+       EOF
+update-grub
+# End post install kernel options update
index 468307e007e631e9566e9c51d8e7ab751d481bd4..1c5928a5cdfe8475a42e3fcdf06249bfc74862e5 100644 (file)
@@ -245,9 +245,6 @@ gpg-keys
 hostname
     Check and set proper fqdn. See, ``roles/testnode/tasks/set_hostname.yml``.
 
-kernel_logging
-    Runs a script that enabled kernel logging to the console on ubuntu.
-
 lvm
     Configures logical volumes if dicts are defined in the secrets repo.
 
diff --git a/roles/testnode/files/scripts/kernel_logging.sh b/roles/testnode/files/scripts/kernel_logging.sh
deleted file mode 100644 (file)
index 98a1b0d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-# {{ ansible_managed }}
-
-set -e
-f=/etc/default/grub
-#Mira are ttyS2
-miracheck=$(uname -n | grep -ic mira || true)
-typicacheck=$(uname -n | grep -ic typica || true)
-# if it has a setting, make sure it's to ttyS1
-if [ $miracheck -gt 0 ]
-then
-if grep -q '^GRUB_CMDLINE_LINUX=.*".*console=tty0 console=ttyS[012],115200' $f; then sed 's/console=ttyS[012]/console=ttyS2/' <$f >$f.chef; fi
-else
-if [ $typicacheck -gt 0 ]
-then
-if grep -q '^GRUB_CMDLINE_LINUX=.*".*console=ttyS[012],115200' $f; then sed 's/console=ttyS[012]/console=ttyS0/' <$f >$f.chef; fi
-else
-if grep -q '^GRUB_CMDLINE_LINUX=.*".*console=ttyS[01],115200' $f; then sed 's/console=ttyS[01]/console=ttyS1/' <$f >$f.chef; fi
-fi
-fi
-
-# if it has no setting, add it
-if [ $miracheck -gt 0 ]
-then
-if ! grep -q '^GRUB_CMDLINE_LINUX=.*".* console=tty0 console=ttyS[012],115200.*' $f; then sed 's/^GRUB_CMDLINE_LINUX="\(.*\)"$/GRUB_CMDLINE_LINUX="\1 console=tty0 console=ttyS2,115200"/' <$f >$f.chef; fi
-else
-if [ $typicacheck -gt 0 ]
-then
-if ! grep -q '^GRUB_CMDLINE_LINUX=.*".*console=ttyS[012],115200.*' $f; then sed 's/^GRUB_CMDLINE_LINUX="\(.*\)"$/GRUB_CMDLINE_LINUX="\1 console=ttyS0,115200"/' <$f >$f.chef; fi
-else
-if ! grep -q '^GRUB_CMDLINE_LINUX=.*".* console=ttyS[01],115200.*' $f; then sed 's/^GRUB_CMDLINE_LINUX="\(.*\)"$/GRUB_CMDLINE_LINUX="\1 console=ttyS1,115200"/' <$f >$f.chef; fi
-if grep -q '^GRUB_CMDLINE_LINUX=.*".*console=ttyS[01],115200' $f; then sed 's/console=ttyS[01]/console=ttyS1/' <$f >$f.chef; fi
-fi
-fi
-
-
-# if we did something; move it into place.  update-grub done below.
-if [ -f $f.chef ] ; then mv $f.chef $f; fi
-
-#Remove quiet kernel output:
-sed -i 's/quiet//g' $f
-serialcheck=$(grep -ic serial $f || true)
-if [ $serialcheck -eq 0 ]
-then
-if [ $miracheck -gt 0 ]
-then
-echo "" >> $f
-echo "GRUB_TERMINAL=serial" >> $f
-echo "GRUB_SERIAL_COMMAND=\"serial --unit=2 --speed=115200 --stop=1\"" >> $f
-else
-if [ $typicacheck -gt 0 ]
-then
-echo "" >> $f
-echo "GRUB_TERMINAL=serial" >> $f
-echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200 --stop=1\"" >> $f
-else
-echo "" >> $f
-echo "GRUB_TERMINAL=serial" >> $f
-echo "GRUB_SERIAL_COMMAND=\"serial --unit=1 --speed=115200 --stop=1\"" >> $f
-fi
-fi
-fi
-
-#Don't hide grub menu
-
-sed -i 's/^GRUB_HIDDEN_TIMEOUT.*//g' $f
-
-#No PCI reallocation (breaks 10 gig on burnupi)
-sed -i 's;" console=ttyS;"pci=realloc=off console=ttyS;g' $f
-
-#set verbose kernel output via dmesg:
-if ! grep -q dmesg /etc/rc.local; then sed -i 's/^exit 0/dmesg -n 7\nexit 0/g' /etc/rc.local; fi
-
-# touch this file so we know not to run this script again
-touch /kernel-logging-setup
index 836669d5a82e96b5da328f51de9ec6470a90c7dd..fdf51f9106bac070a75600bc1854fada8665ac4e 100644 (file)
     group: root
     mode: 0755
 
-- name: Enable kernel logging to console.
-  script: scripts/kernel_logging.sh creates=/kernel-logging-setup
-  register: kernel_logging
-  tags:
-    - kernel_logging
-
-- name: Update grub
-  command: update-grub
-  when: kernel_logging|changed
-  tags:
-    - kernel_logging
-
 - name: Enable kernel modules to load at boot time.
   template:
     src: modules