fix(linux-baseline): correct MOTD padding math
Previous template used inline arithmetic that miscounted the box width, leaving the right border misaligned on real hostnames. Switch to computed labels + a fixed inner_width so any hostname / OS string pads to the same border position.
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
|
{% set host_label = baseline_motd_banner ~ ' - ' ~ inventory_hostname %}
|
||||||
|
{% set os_label = ansible_distribution ~ ' ' ~ ansible_distribution_version ~ ' (' ~ ansible_kernel ~ ')' %}
|
||||||
|
{% set inner_width = 61 %}
|
||||||
|
|
||||||
╔═══════════════════════════════════════════════════════════════╗
|
╔═══════════════════════════════════════════════════════════════╗
|
||||||
║ ║
|
║{{ ' ' * inner_width }}║
|
||||||
║ {{ baseline_motd_banner }} - {{ inventory_hostname }}{{ ' ' * (50 - (baseline_motd_banner | length) - (inventory_hostname | length)) }}║
|
║ {{ host_label }}{{ ' ' * (inner_width - 3 - host_label | length) }}║
|
||||||
║ ║
|
║{{ ' ' * inner_width }}║
|
||||||
║ {{ ansible_distribution }} {{ ansible_distribution_version }} ({{ ansible_kernel }}){{ ' ' * (53 - (ansible_distribution | length) - (ansible_distribution_version | length) - (ansible_kernel | length)) }}║
|
║ {{ os_label }}{{ ' ' * (inner_width - 3 - os_label | length) }}║
|
||||||
║ ║
|
║{{ ' ' * inner_width }}║
|
||||||
║ Managed by Ansible. Local changes will be overwritten. ║
|
║ Managed by Ansible. Local changes will be overwritten. ║
|
||||||
║ ║
|
║{{ ' ' * inner_width }}║
|
||||||
╚═══════════════════════════════════════════════════════════════╝
|
╚═══════════════════════════════════════════════════════════════╝
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user