Better way to handle the serial console
This commit is contained in:
parent
317bed2eb6
commit
9c620cb28f
@ -17,10 +17,4 @@
|
||||
name: "{{ timezone }}"
|
||||
notify: restart cron
|
||||
|
||||
- name: enable serial console
|
||||
service:
|
||||
name: getty@ttyS0.service
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
# vim:ft=yaml.ansible:
|
||||
|
2
roles/grub/handlers/main.yaml
Normal file
2
roles/grub/handlers/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
- name: grub-mkconfig
|
||||
command: "grub-mkconfig -o {{ grub_cfg_path }}"
|
7
roles/grub/tasks/Debian.yaml
Normal file
7
roles/grub/tasks/Debian.yaml
Normal 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
|
12
roles/grub/tasks/main.yaml
Normal file
12
roles/grub/tasks/main.yaml
Normal 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"
|
7
roles/grub/vars/Debian.yaml
Normal file
7
roles/grub/vars/Debian.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user