From 6bf4815503807737c882659659b7b1325f7176e2 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Wed, 26 Aug 2020 20:12:12 +0300 Subject: [PATCH] Store console output to logfile on kvm guests --- playbooks/include/vm-create.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playbooks/include/vm-create.yml b/playbooks/include/vm-create.yml index bdbeb96..79f3367 100644 --- a/playbooks/include/vm-create.yml +++ b/playbooks/include/vm-create.yml @@ -5,6 +5,7 @@ vars: letters: "{{ 'bcdefghijklmnopqrstuvwxyz'|list }}" + console_log: "/var/log/libvirt/qemu/{{ inventory_hostname }}.console.log" vmhost_uri: "qemu+ssh://root@{{ vmhost }}/system" root_pubkey: "{{ lookup('file', '/srv/ansible-private/ssh/id_rsa.pub') }}" extra_disks: >- @@ -62,7 +63,8 @@ command: > virt-install --connect {{ vmhost_uri }} \ --name {{ inventory_hostname }} \ - --graphics none --boot useserial=on --serial pty --noautoconsole \ + --graphics none --boot useserial=on --noautoconsole \ + --serial pty,log.file={{ console_log }} \ --controller usb,model=none --sound none --memory {{ mem_size }} \ --vcpus {{ num_cpus }} --cpu host-passthrough \ --disk /srv/libvirt/ssd/{{ inventory_hostname }}.a.img,cache=none,format=raw,bus=virtio,size={{ dsk_size }} \