-
Notifications
You must be signed in to change notification settings - Fork 9
Permit disabling serial console if there is none #5
base: master
Are you sure you want to change the base?
Conversation
The serial console should be enabled by default, hence the introduction a default value enabling if not explicitely disabled. Verified with: HPE ProLiant MicroServer Gen10 which has neither an iLO-based BMC with virtual serial port, nor any physical serial port by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, just one little thing. A little bit of nitpicking.
templates/etc/default/grub.j2
Outdated
@@ -16,9 +16,12 @@ GRUB_TIMEOUT={{ grub_timeout }} | |||
GRUB_DISTRIBUTOR=$(lsb_release -i -s 2>/dev/null || echo {{ ansible_distribution }}) | |||
GRUB_CMDLINE_LINUX_DEFAULT="{{ grub_console }}" | |||
GRUB_CMDLINE_LINUX="{{ grub_cmdline_linux | join(' ') }}" | |||
{% if grub_serial | d(False) %} | |||
{% if grub_serial_enabled == True %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just write {% if grub_serial_enabled %}
, as this is shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed with aa5de19
templates/etc/default/grub.j2
Outdated
GRUB_SERIAL_COMMAND="serial --speed={{ grub_serial.speed }} --unit={{ grub_serial.unit }} --word={{ grub_serial.word }} --parity={{ grub_serial.parity }} --stop={{ grub_serial.stop }}" | ||
{% endif %} | ||
|
||
# disable graphical terminal (grub-pc only) | ||
{% if grub_serial_enabled == True %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just write {% if grub_serial_enabled %}
, as this is shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two consecutive equal if
-statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, fixed with aa5de19
GRUB_TERMINAL=console | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endif
has no corresponding if
-block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it should be since aa5de19
@@ -5,6 +5,8 @@ grub_consoles: | |||
- tty0 | |||
- 'ttyS0,{{ grub_serial.speed }}' | |||
|
|||
grub_serial_enabled: True | |||
|
|||
# grub serial command settings | |||
grub_serial: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this one. In my mind it makes more sense to add grub_serial_enabled
to the grub_serial
-block:
grub_serial: | |
grub_serial: | |
enabled: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have actually tried this, the issue was that if you have a system with no serial console you'd actually have to override "enabled" + ALL the other elements needlessly (speed, unit, word, parity and stop) since if you only define i.e.
grub_serial:
enabled: False
It will fail because you end up with the remaining element being undefined which trips Ansible.
* {% if grub_serial_enabled == True %} -> {% if grub_serial_enabled %} * Remove unneeded double if statement
SUMMARY
The serial console should be enabled by default, hence the introduction a default value enabling if not explicitely disabled. This does NOT change the default behaviour which is intended.
Verified with: HPE ProLiant MicroServer Gen10 which has neither any iLO-based BMC with virtual serial port, nor any physical serial port by default.
ISSUE TYPE
(actually a bit both)
ANSIBLE VERSION
ADDITIONAL INFORMATION