Skip to content

Commit 9b3b2fd

Browse files
mmalchukmarkgoddard
authored andcommitted
Fix Apparmor libvirt profile removal
The apparmor_parser actually doesn't remove the file or doesn't create the symlink in '/etc/apparmor.d/disable' itself so the next run of the baremetal role will fail with the error "Unable to remove "libvirtd". Even more after reboot, the profile is still active. We need to disable the profile completly ourselves. This change fixes the idempotents of the baremetal role. Closes-Bug: #1960302 Change-Id: I162e417387393e806886b1c9ea8053b89778b4d1 Signed-off-by: Maksim Malchuk <[email protected]> (cherry picked from commit 75f55d1)
1 parent 3c01e77 commit 9b3b2fd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ansible/roles/baremetal/tasks/post-install.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@
201201
when: ansible_facts.distribution == "Ubuntu"
202202

203203
- name: Remove apparmor profile for libvirt
204-
command: apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
204+
shell: |
205+
apparmor_parser -v -R /etc/apparmor.d/usr.sbin.libvirtd && \
206+
ln -vsf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable
207+
args:
208+
executable: /bin/bash
205209
become: True
206210
when:
207211
- ansible_facts.distribution == "Ubuntu"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes the baremetal role to avoid an error "Unable to remove "libvirtd".
5+
Now the symlink /etc/apparmor.d/disable/usr.sbin.libvirtd is created by
6+
the role.
7+
`LP#1960302 <https://bugs.launchpad.net/kolla-ansible/+bug/1960302>`__

0 commit comments

Comments
 (0)