Skip to content

Commit

Permalink
Ubuntu: Install apparmor package for apparmor_parser
Browse files Browse the repository at this point in the history
In some cases AppArmor may be enabled, but the apparmor package that
provides apparmor_parser is not installed.
  • Loading branch information
markgoddard committed Mar 23, 2021
1 parent 83f6590 commit 17d1137
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
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
3 changes: 2 additions & 1 deletion tasks/post-install-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
line: " {{ item.path }}/** rwk,"
become: true
when:
- item.type == "dir"
- 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

0 comments on commit 17d1137

Please sign in to comment.