From 72b256510e16db55bb5028560ea91021be89b3b8 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 23 Aug 2023 02:14:33 +0400 Subject: [PATCH 1/3] fix kvm support on apple silicon --- molecule_qemu/playbooks/create.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/molecule_qemu/playbooks/create.yml b/molecule_qemu/playbooks/create.yml index 0611a50..820be79 100644 --- a/molecule_qemu/playbooks/create.yml +++ b/molecule_qemu/playbooks/create.yml @@ -10,6 +10,7 @@ molecule_scenario_name: "{{ lookup('env', 'MOLECULE_SCENARIO_NAME') }}" molecule_project_name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" qemu_cap_hvf: false + qemu_cap_kvm: false qemu_image_arch: "x86_64" qemu_image_format: "qcow2" qemu_vm_memory: "512" From 9da8182e66475ae47bb34d00ba679e0b808c574c Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 23 Aug 2023 02:31:29 +0400 Subject: [PATCH 2/3] fix kvm support on github actions --- molecule_qemu/playbooks/create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule_qemu/playbooks/create.yml b/molecule_qemu/playbooks/create.yml index 820be79..d2f1c3b 100644 --- a/molecule_qemu/playbooks/create.yml +++ b/molecule_qemu/playbooks/create.yml @@ -132,7 +132,7 @@ - name: Set kvm support ansible.builtin.set_fact: - qemu_cap_kvm: "{{ kvm_support is defined }}" + qemu_cap_kvm: "{{ kvm_support.rc == 0 }}" when: ansible_system == 'Linux' ### prerequisites ######################################################### From 718e2fd6dbb859705af600ddf57d7c53dfeccbb2 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 23 Aug 2023 02:34:54 +0400 Subject: [PATCH 3/3] some love for ansible code (update code style) --- molecule_qemu/playbooks/create.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule_qemu/playbooks/create.yml b/molecule_qemu/playbooks/create.yml index d2f1c3b..f1b0e82 100644 --- a/molecule_qemu/playbooks/create.yml +++ b/molecule_qemu/playbooks/create.yml @@ -102,12 +102,12 @@ qemu_network_mode: "{{ molecule_instances | map(attribute='network_mode') | list | unique | first }}" - name: Assert VMs ssh configuration + when: qemu_network_mode == 'user' ansible.builtin.assert: that: - molecule_instances | map(attribute='network_ssh_port') | list | unique | length == molecule_instances | length fail_msg: "Molecule instances SSH are not properly configured for 'user' network" success_msg: "Molecule instances SSH are properly configured for 'user' network" - when: qemu_network_mode == 'user' ### capabilities ########################################################## @@ -119,9 +119,9 @@ ignore_errors: true - name: Set hvf support + when: ansible_system == 'Darwin' and hv_support is defined ansible.builtin.set_fact: qemu_cap_hvf: "{{ hv_support.stdout | trim == 'kern.hv_support: 1' }}" - when: hv_support is defined and ansible_system == 'Darwin' - name: Check kvm support when: ansible_system == 'Linux' @@ -131,9 +131,9 @@ ignore_errors: true - name: Set kvm support + when: ansible_system == 'Linux' and kvm_support is defined ansible.builtin.set_fact: qemu_cap_kvm: "{{ kvm_support.rc == 0 }}" - when: ansible_system == 'Linux' ### prerequisites ######################################################### @@ -156,12 +156,12 @@ register: ssh_keypair - name: Fetch ARM VMs bios + when: "'aarch64' in molecule_instances | map(attribute='image_arch') | list | unique" ansible.builtin.copy: src: "QEMU_EFI.fd" dest: "{{ molecule_driver_directory }}/QEMU_EFI.fd" checksum: "784ad38513e327287e96d511c9ca0219aa94e672" mode: "0644" - when: "'aarch64' in molecule_instances | map(attribute='image_arch') | list | unique" ### images ###############################################################