Skip to content

Commit 7964f3e

Browse files
authored
Merge pull request #47 from stackhpc/fix-apparmor-no-daemon
Fix AppArmor configuration without daemon install
2 parents a8ccd60 + 17d1137 commit 7964f3e

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

tasks/install-daemon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
- name: Ensure libvirt packages are installed
1616
package:
17-
name: "{{ libvirt_host_libvirt_packages }}"
17+
name: "{{ libvirt_host_libvirt_packages | select | list }}"
1818
state: present
1919
register: result
2020
until: result is success

tasks/post-install-Debian.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
insertbefore: "^}"
3333
line: " {{ item.path }}/** rwk,"
3434
become: true
35-
when: item.type == "dir"
35+
when:
36+
- libvirt_host_install_daemon | bool
37+
- ansible_apparmor.status | default == 'enabled'
38+
- item.type == "dir"
3639
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
3740
notify:
3841
- reload libvirt qemu apparmor profile template

vars/Debian.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
libvirt_host_libvirt_packages_common:
44
- qemu-kvm
55

6-
# Package that contains the libvirt daemon
7-
libvirt_host_libvirt_packages_libvirt_daemon: >-
8-
{%- if (ansible_distribution == "Ubuntu" and
9-
ansible_distribution_major_version is version_compare('16.04', '<')) or
10-
(ansible_distribution == "Debian" and
11-
ansible_distribution_major_version is version_compare('8', '<')) -%}
12-
libvirt-bin
13-
{%- else -%}
14-
libvirt-daemon-system
15-
{%- endif -%}
6+
# List of all daemon packages to install.
7+
libvirt_host_libvirt_packages_libvirt_daemon:
8+
# The apparmor package contains the apparmor_parser tool.
9+
- "{% if ansible_apparmor.status| default == 'enabled' %}apparmor{% endif %}"
10+
- >-
11+
{%- if (ansible_distribution == "Ubuntu" and
12+
ansible_distribution_major_version is version_compare('16.04', '<')) or
13+
(ansible_distribution == "Debian" and
14+
ansible_distribution_major_version is version_compare('8', '<')) -%}
15+
libvirt-bin
16+
{%- else -%}
17+
libvirt-daemon-system
18+
{%- endif -%}
1619
1720
# List of all client packages to install.
1821
libvirt_host_libvirt_packages_client:
@@ -27,7 +30,7 @@ libvirt_host_packages_efi:
2730
# List of all packages to install
2831
libvirt_host_libvirt_packages: >
2932
{{ libvirt_host_libvirt_packages_common +
30-
[libvirt_host_libvirt_packages_libvirt_daemon] +
33+
libvirt_host_libvirt_packages_libvirt_daemon +
3134
libvirt_host_libvirt_packages_client +
3235
(libvirt_host_packages_efi if libvirt_host_enable_efi_support else []) | unique
3336
}}

0 commit comments

Comments
 (0)