This commit is contained in:
parent
889e7b70af
commit
738ceb71c0
@ -4,4 +4,4 @@
|
|||||||
kvm_users: []
|
kvm_users: []
|
||||||
# - name: markus
|
# - name: markus
|
||||||
|
|
||||||
kvm_virtual_machine_manager: false
|
kvm_virtual_machine_manager: false
|
||||||
|
@ -1 +0,0 @@
|
|||||||
---
|
|
@ -1,12 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Read cpuinfo from kernel
|
- name: Read cpuinfo from kernel
|
||||||
shell: cat /proc/cpuinfo
|
ansible.builtin.command:
|
||||||
|
cmd: cat /proc/cpuinfo
|
||||||
register: cpu_info
|
register: cpu_info
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Verify if Intel VMX or AMD SVM is enabled
|
- name: Verify if Intel VMX or AMD SVM is enabled
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: "Intel VMX or AMD SVE not enabled"
|
msg: "Intel VMX or AMD SVE not enabled"
|
||||||
when: "'vmx' not in cpu_info.stdout and 'svm' not in cpu_info.stdout"
|
when: "'vmx' not in cpu_info.stdout and 'svm' not in cpu_info.stdout"
|
||||||
|
|
||||||
@ -14,12 +15,12 @@
|
|||||||
include_vars: "{{ ansible_os_family }}.yml"
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
|
||||||
- name: Add virt-manager to list of kvm packages
|
- name: Add virt-manager to list of kvm packages
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
kvm_package_names: "{{ kvm_package_names + kvm_vm_manager_package_names }}"
|
kvm_package_names: "{{ kvm_package_names + kvm_vm_manager_package_names }}"
|
||||||
when: kvm_virtual_machine_manager
|
when: kvm_virtual_machine_manager
|
||||||
|
|
||||||
- name: Install kvm packages
|
- name: Install kvm packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
@ -29,12 +30,12 @@
|
|||||||
when: cpu_info.stdout.find('sev') != -1
|
when: cpu_info.stdout.find('sev') != -1
|
||||||
block:
|
block:
|
||||||
- name: Load kernel module "kvm_amd" temporarily
|
- name: Load kernel module "kvm_amd" temporarily
|
||||||
modprobe:
|
community.general.modprobe:
|
||||||
name: "kvm_amd"
|
name: "kvm_amd"
|
||||||
params: "sev=1"
|
params: "sev=1"
|
||||||
state: present
|
state: present
|
||||||
- name: Load kernel module "kvm_amd" persistently
|
- name: Load kernel module "kvm_amd" persistently
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "etc/modules-load.d/10-amd-sve.conf.j2"
|
src: "etc/modules-load.d/10-amd-sve.conf.j2"
|
||||||
dest: "/etc/modules-load.d/10-amd-sve.conf"
|
dest: "/etc/modules-load.d/10-amd-sve.conf"
|
||||||
owner: root
|
owner: root
|
||||||
@ -42,14 +43,14 @@
|
|||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
||||||
- name: Append unix user to unix groups to interact with qemu/kvm
|
- name: Append unix user to unix groups to interact with qemu/kvm
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
append: yes
|
append: true
|
||||||
groups: "{{ kvm_unix_groups }}"
|
groups: "{{ kvm_unix_groups }}"
|
||||||
with_items: "{{ kvm_users }}"
|
with_items: "{{ kvm_users }}"
|
||||||
|
|
||||||
- name: Start and enable {{ kvm_service_name }}
|
- name: Start and enable {{ kvm_service_name }}
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ kvm_service_name }}"
|
name: "{{ kvm_service_name }}"
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: true
|
||||||
|
Loading…
Reference in New Issue
Block a user