Skip to content

Commit

Permalink
Merge pull request #22 from andreygubarev/fix-kvm-support-apple-silicon
Browse files Browse the repository at this point in the history
fix kvm support
  • Loading branch information
andreygubarev authored Aug 22, 2023
2 parents dfdab93 + 718e2fd commit 3b0d445
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions molecule_qemu/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -101,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 ##########################################################

Expand All @@ -118,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'
Expand All @@ -130,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 is defined }}"
when: ansible_system == 'Linux'
qemu_cap_kvm: "{{ kvm_support.rc == 0 }}"

### prerequisites #########################################################

Expand All @@ -155,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 ###############################################################

Expand Down

0 comments on commit 3b0d445

Please sign in to comment.