Skip to content

Fix AppArmor configuration without daemon install #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/install-daemon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- name: Ensure libvirt packages are installed
package:
name: "{{ libvirt_host_libvirt_packages }}"
name: "{{ libvirt_host_libvirt_packages | select | list }}"
state: present
register: result
until: result is success
Expand Down
5 changes: 4 additions & 1 deletion tasks/post-install-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
insertbefore: "^}"
line: " {{ item.path }}/** rwk,"
become: true
when: item.type == "dir"
when:
- libvirt_host_install_daemon | bool
- ansible_apparmor.status | default == 'enabled'
- item.type == "dir"
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
notify:
- reload libvirt qemu apparmor profile template
25 changes: 14 additions & 11 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
libvirt_host_libvirt_packages_common:
- qemu-kvm

# Package that contains the libvirt daemon
libvirt_host_libvirt_packages_libvirt_daemon: >-
{%- if (ansible_distribution == "Ubuntu" and
ansible_distribution_major_version is version_compare('16.04', '<')) or
(ansible_distribution == "Debian" and
ansible_distribution_major_version is version_compare('8', '<')) -%}
libvirt-bin
{%- else -%}
libvirt-daemon-system
{%- endif -%}
# List of all daemon packages to install.
libvirt_host_libvirt_packages_libvirt_daemon:
# The apparmor package contains the apparmor_parser tool.
- "{% if ansible_apparmor.status| default == 'enabled' %}apparmor{% endif %}"
- >-
{%- if (ansible_distribution == "Ubuntu" and
ansible_distribution_major_version is version_compare('16.04', '<')) or
(ansible_distribution == "Debian" and
ansible_distribution_major_version is version_compare('8', '<')) -%}
libvirt-bin
{%- else -%}
libvirt-daemon-system
{%- endif -%}

# List of all client packages to install.
libvirt_host_libvirt_packages_client:
Expand All @@ -27,7 +30,7 @@ libvirt_host_packages_efi:
# List of all packages to install
libvirt_host_libvirt_packages: >
{{ libvirt_host_libvirt_packages_common +
[libvirt_host_libvirt_packages_libvirt_daemon] +
libvirt_host_libvirt_packages_libvirt_daemon +
libvirt_host_libvirt_packages_client +
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
}}
Expand Down