common: enable serial console on KVM VMs

This commit is contained in:
Markus 2021-07-31 00:12:22 +02:00
parent 36b75e1c6a
commit 1b0db12005
2 changed files with 12 additions and 0 deletions

View File

@ -3,5 +3,8 @@
- name: Restart journald
service: name=systemd-journald state=restarted
- name: update-grub
command: update-grub
- name: update-initramfs
command: update-initramfs -u -k all

View File

@ -38,6 +38,15 @@
copy: src=resume dest=/etc/initramfs-tools/conf.d/resume
notify: update-initramfs
- name: Enable serial console on KVM VMs
lineinfile:
path: "/etc/default/grub"
state: "present"
regexp: "^#?GRUB_CMDLINE_LINUX=.*"
line: "GRUB_CMDLINE_LINUX=\"console=ttyS0,115200 console=tty0\""
notify: update-grub
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm"
- name: Prevent normal users from running su
lineinfile:
path: /etc/pam.d/su