Better way to handle the serial console

This commit is contained in:
Ryan Cavicchioni 2019-10-05 17:58:44 -05:00
parent 317bed2eb6
commit 9c620cb28f
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
5 changed files with 28 additions and 6 deletions

View File

@ -17,10 +17,4 @@
name: "{{ timezone }}" name: "{{ timezone }}"
notify: restart cron notify: restart cron
- name: enable serial console
service:
name: getty@ttyS0.service
state: started
enabled: yes
# vim:ft=yaml.ansible: # vim:ft=yaml.ansible:

View File

@ -0,0 +1,2 @@
- name: grub-mkconfig
command: "grub-mkconfig -o {{ grub_cfg_path }}"

View File

@ -0,0 +1,7 @@
---
- name: enable serial console
lineinfile:
path: "{{ grub_defaults_path }}"
regexp: '^GRUB_CMDLINE_LINUX='
line: GRUB_CMDLINE_LINUX="{{ grub_cmdline_linux }}"
notify: grub-mkconfig

View File

@ -0,0 +1,12 @@
---
- name: gather OS specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- name: run os specific tasks
include: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}.yaml"

View File

@ -0,0 +1,7 @@
---
grub_cfg_path: /boot/grub/grub.cfg
grub_defaults_path: /etc/default/grub
# Enables serial console.
# This is helpful for libvirt guests
grub_cmdline_linux: console=ttyS0