--- /dev/null
+- name: Install rngd
+ apt:
+ name: rng-tools
+ state: present
+
+- name: Configure rngd
+ lineinfile:
+ path: /etc/default/rng-tools
+ line: '{{ item.key }}={{ item.value }}'
+ regexp: '^#?{{ item.key }}={{ item.value }}'
+ with_dict:
+ HRNGDEVICE: /dev/hwrng
+ RNGDOPTIONS: '"-s 256 -W 80%"'
+ loop_control:
+ label: "{{ item.key }}"
+ notify: restart rngd
{% endif %}
<devices>
<emulator>/usr/bin/kvm</emulator>
+ <!-- Provide a virtualized RNG to the guest -->
+ <rng model='virtio'>
+ <!-- Allow consuming up to 10kb/s, measured over 2s -->
+ <rate period="2000" bytes="20480"/>
+ <backend model='random'>/dev/urandom</backend>
+ </rng>
{% if 'virtio' in hostvars[vmname].vm_install_cooked.disks %}
{% for device, lv in hostvars[vmname].vm_install_cooked.disks.virtio.items() %}