From: Chris Wheeler Date: Mon, 17 Jun 2024 16:59:59 +0000 (-0700) Subject: Parameterize qemu-kvm emulator path for portability across Linux distros. X-Git-Tag: j-release~4^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=361fd585032b14a918b306b8a56c03bc3095cbc4;hp=-c;p=pti%2Frtp.git Parameterize qemu-kvm emulator path for portability across Linux distros. Issue-ID: INF-441 Change-Id: I7da6fd4fff3464605145acdf9c1114ef2242bcfe Signed-off-by: Chris Wheeler --- 361fd585032b14a918b306b8a56c03bc3095cbc4 diff --git a/okd/roles/ocloud_infra_vm/tasks/main.yml b/okd/roles/ocloud_infra_vm/tasks/main.yml index 320e4df..0594ecb 100644 --- a/okd/roles/ocloud_infra_vm/tasks/main.yml +++ b/okd/roles/ocloud_infra_vm/tasks/main.yml @@ -21,6 +21,19 @@ run_once: true become: true +- name: Locate qemu-kvm emulator + stat: + path: "{{ item }}" + register: ocloud_infra_vm_emulator_stat + loop: + - /usr/bin/qemu-kvm + - /usr/libexec/qemu-kvm + +- set_fact: + ocloud_infra_vm_emulator_path: "{{ item.stat.path }}" + when: item.stat.exists + loop: "{{ ocloud_infra_vm_emulator_stat.results }}" + - name: Create virtual machine - {{ inventory_hostname }} community.libvirt.virt: command: define diff --git a/okd/roles/ocloud_infra_vm/templates/virt.xml.j2 b/okd/roles/ocloud_infra_vm/templates/virt.xml.j2 index 3f6565e..283faf7 100644 --- a/okd/roles/ocloud_infra_vm/templates/virt.xml.j2 +++ b/okd/roles/ocloud_infra_vm/templates/virt.xml.j2 @@ -25,7 +25,7 @@ - /usr/libexec/qemu-kvm + {{ ocloud_infra_vm_emulator_path }}