base: Enable serial console on KVM VMs

Occasionally, VMs running on the main libvirt VM hosts will freeze or
otherwise become unavailable via network.  Sometimes, when this happens,
their normal consoles are unresponsive as well.  Having the serial
console available as a fallback can sometimes be helpful in recovering
from such situations.

To ensure the serial console is available on all VMs, we use a "dynamic"
group, based on the virtualization type and role of the managed node.
All KVM-based virtual machines are included in a group named *kvm-vm*.
A play in `base.yml` applies the *serial-console* role to members of
this group.
jenkins-master
Dustin 2021-08-24 19:56:22 -05:00
parent 8b91265ffe
commit 00d30a67fb
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,7 @@
- import_playbook: dyngroups.yml
- hosts: all
roles:
- base
- hosts: kvm-guest
roles:
- serial-console

View File

@ -3,4 +3,10 @@
tasks:
- name: group hosts by distribution
group_by:
key={{ ansible_os_family }}
key: '{{ ansible_os_family }}'
changed_when: false
- name: group hosts by virtualization
group_by:
key: >-
{{ ansible_virtualization_type }}-{{ ansible_virtualization_role }}
changed_when: false