|
188 | 188 | daemon_reload: yes
|
189 | 189 | register: docker_reloaded
|
190 | 190 |
|
191 |
| -- name: Get stat of libvirtd apparmor profile |
192 |
| - stat: |
193 |
| - path: /etc/apparmor.d/usr.sbin.libvirtd |
194 |
| - register: apparmor_libvirtd_profile |
195 |
| - when: ansible_facts.distribution == "Ubuntu" |
196 |
| - |
197 |
| -- name: Get stat of libvirtd apparmor disable profile |
198 |
| - stat: |
199 |
| - path: /etc/apparmor.d/disable/usr.sbin.libvirtd |
200 |
| - register: apparmor_libvirtd_disable_profile |
201 |
| - when: ansible_facts.distribution == "Ubuntu" |
202 |
| - |
203 |
| -- name: Remove apparmor profile for libvirt |
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 |
209 |
| - become: True |
| 191 | +- block: |
| 192 | + - name: Get stat of libvirtd apparmor profile |
| 193 | + stat: |
| 194 | + path: /etc/apparmor.d/usr.sbin.libvirtd |
| 195 | + register: apparmor_libvirtd_profile |
| 196 | + |
| 197 | + - name: Get stat of libvirtd apparmor disable profile |
| 198 | + stat: |
| 199 | + path: /etc/apparmor.d/disable/usr.sbin.libvirtd |
| 200 | + register: apparmor_libvirtd_disable_profile |
| 201 | + |
| 202 | + - name: Remove apparmor profile for libvirt |
| 203 | + shell: | |
| 204 | + apparmor_parser -v -R /etc/apparmor.d/usr.sbin.libvirtd && \ |
| 205 | + ln -vsf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable |
| 206 | + args: |
| 207 | + executable: /bin/bash |
| 208 | + become: True |
| 209 | + when: |
| 210 | + - apparmor_libvirtd_profile.stat.exists |
| 211 | + - not apparmor_libvirtd_disable_profile.stat.exists |
210 | 212 | when:
|
211 | 213 | - ansible_facts.distribution == "Ubuntu"
|
212 |
| - - apparmor_libvirtd_profile.stat.exists |
213 |
| - - not apparmor_libvirtd_disable_profile.stat.exists |
| 214 | + - apparmor_remove_libvirt_profile | bool |
214 | 215 |
|
215 | 216 | - name: Get stat of chronyd apparmor profile
|
216 | 217 | stat:
|
|
0 commit comments