diff --git a/defaults/main.yml b/defaults/main.yml index be977b9c..b35913f2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -415,6 +415,10 @@ nova_compute_lxd_pip_packages: nova_qemu_user: libvirt-qemu nova_qemu_group: kvm +# Define the following variable to drop a replacement +# file for /etc/libvirt/qemu.conf +#qemu_conf_dict: {} + # This variable is used by the repo_build process to determine # which host group to check for members of before building the # pip packages required by this role. The value is picked up diff --git a/releasenotes/notes/add-qemu-conf-d42337dfd42bac6f.yaml b/releasenotes/notes/add-qemu-conf-d42337dfd42bac6f.yaml new file mode 100644 index 00000000..da48406a --- /dev/null +++ b/releasenotes/notes/add-qemu-conf-d42337dfd42bac6f.yaml @@ -0,0 +1,4 @@ +--- +features: + - The os_nova role can now deploy the a custom + /etc/libvirt/qemu.conf file by defining ``qemu_conf_dict``. diff --git a/tasks/nova_compute_kvm.yml b/tasks/nova_compute_kvm.yml index 1c7d62b1..bb6b3688 100644 --- a/tasks/nova_compute_kvm.yml +++ b/tasks/nova_compute_kvm.yml @@ -40,6 +40,19 @@ - nova-kvm - nova-libvirt +- name: Set qemu config + template: + src: "qemu.conf.j2" + dest: "/etc/libvirt/qemu.conf" + owner: "root" + group: "root" + mode: "0600" + when: qemu_conf_dict is defined + notify: Restart libvirt-bin + tags: + - nova-kvm + - nova-libvirt + - name: Set libvirt runtime options lineinfile: dest: "/etc/default/libvirt-bin" diff --git a/templates/qemu.conf.j2 b/templates/qemu.conf.j2 new file mode 100644 index 00000000..9a9934d4 --- /dev/null +++ b/templates/qemu.conf.j2 @@ -0,0 +1,4 @@ +# {{ ansible_managed }} +{% for key, value in qemu_conf_dict.iteritems() %} +{{ key }} = {{ value }} +{% endfor %}