Skip to content

Commit

Permalink
fix: better handling of changed status
Browse files Browse the repository at this point in the history
  • Loading branch information
bachradsusi committed Oct 5, 2023
1 parent efd823a commit db129a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/tests_modifications_with_selinux_disabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
name: sar-user
- name: Switch to permissive to allow login when selinuxfs is not mounted
command: setenforce 0
changed_when: false
when: ansible_selinux.status != "disabled"
changed_when: true
when: ansible_selinux.status != "disabled" and
ansible_selinux.status != "permissive"
- name: Get selinuxfs mountpoint
command: findmnt -n -t selinuxfs --output=target
changed_when: false
Expand All @@ -29,7 +30,7 @@
Umount selinux mountpoint to emulate SELinux disabled
system {{ selinux_mountpoint.stdout }}
command: umount -l {{ selinux_mountpoint.stdout }}
changed_when: false
when: selinux_mountpoint.stdout != ""
- name: Execute the role and catch errors
block:
Expand All @@ -56,10 +57,11 @@
# noqa command-instead-of-module
command: >-
mount -t selinuxfs selinuxfs {{ selinux_mountpoint.stdout }}
changed_when: false
changed_when: true
- name: Switch back to enforcing
command: setenforce 1
changed_when: false
changed_when: true
when: ansible_selinux.status == "enforcing"
- name: Gather facts again
setup:

Expand Down

0 comments on commit db129a8

Please sign in to comment.