Blame SOURCES/selinux-tier1-tags.diff

921f83
diff --git a/tests/set_selinux_variables.yml b/tests/set_selinux_variables.yml
921f83
index f294101..7571066 100644
921f83
--- a/tests/set_selinux_variables.yml
921f83
+++ b/tests/set_selinux_variables.yml
921f83
@@ -1,4 +1,12 @@
921f83
 ---
921f83
+- name: Install SELinux tool semanage on Fedora
921f83
+  package:
921f83
+    name:
921f83
+      - policycoreutils-python-utils
921f83
+    state: present
921f83
+  when: ansible_distribution == "Fedora" or
921f83
+    ( ansible_distribution_major_version > "7" and
921f83
+      ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
921f83
 - name: Get local modifications - boolean
921f83
   command: /usr/sbin/semanage boolean -l -n -C
921f83
   register: selinux_role_boolean
921f83
diff --git a/tests/tests_all_purge.yml b/tests/tests_all_purge.yml
921f83
index 03dfe05..c686837 100644
921f83
--- a/tests/tests_all_purge.yml
921f83
+++ b/tests/tests_all_purge.yml
921f83
@@ -14,7 +14,9 @@
921f83
         name:
921f83
           - policycoreutils-python-utils
921f83
         state: present
921f83
-      when: ansible_distribution == "Fedora"
921f83
+      when: ansible_distribution == "Fedora" or
921f83
+        ( ansible_distribution_major_version > "7" and
921f83
+          ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
921f83
 
921f83
     - name: Add a Linux System Roles SELinux User
921f83
       user:
921f83
diff --git a/tests/tests_all_transitions.yml b/tests/tests_all_transitions.yml
921f83
index f608a42..d0d209b 100644
921f83
--- a/tests/tests_all_transitions.yml
921f83
+++ b/tests/tests_all_transitions.yml
921f83
@@ -1,6 +1,8 @@
921f83
 - name: Test all the possible selinux_state transitions
921f83
   hosts: all
921f83
   become: true
921f83
+  tags:
921f83
+    - 'tests::reboot'
921f83
   vars:
921f83
     states:
921f83
       - permissive
921f83
diff --git a/tests/tests_boolean.yml b/tests/tests_boolean.yml
921f83
index 47eafc0..2aa0025 100644
921f83
--- a/tests/tests_boolean.yml
921f83
+++ b/tests/tests_boolean.yml
921f83
@@ -1,5 +1,6 @@
921f83
 
921f83
 - name: Check if selinux role sets SELinux booleans
921f83
+  tags: tests::expfail
921f83
   hosts: all
921f83
   become: true
921f83
 
921f83
@@ -12,7 +13,7 @@
921f83
         selinux_booleans:
921f83
           - { name: 'samba_enable_home_dirs', state: 'on', persistent: 'yes' }
921f83
 
921f83
-    - include: set_selinux_variables.yml
921f83
+    - import_tasks: set_selinux_variables.yml
921f83
     - name: save state after initial changes and before other changes
921f83
       set_fact:
921f83
         boolean_before: "{{ selinux_role_boolean.stdout_lines }}"
921f83
diff --git a/tests/tests_fcontext.yml b/tests/tests_fcontext.yml
921f83
index 0a411fb..f6f1bf4 100644
921f83
--- a/tests/tests_fcontext.yml
921f83
+++ b/tests/tests_fcontext.yml
921f83
@@ -13,7 +13,7 @@
921f83
         selinux_fcontexts:
921f83
           - { target: '/tmp/test_dir1(/.*)?', setype: 'user_home_dir_t', ftype: 'd' }
921f83
 
921f83
-    - include: set_selinux_variables.yml
921f83
+    - import_tasks: set_selinux_variables.yml
921f83
     - name: save state after initial changes and before other changes
921f83
       set_fact:
921f83
         fcontext_before: "{{ selinux_role_fcontext.stdout }}"
921f83
diff --git a/tests/tests_login.yml b/tests/tests_login.yml
921f83
index efa826d..c7ce462 100644
921f83
--- a/tests/tests_login.yml
921f83
+++ b/tests/tests_login.yml
921f83
@@ -18,7 +18,7 @@
921f83
           - { login: 'sar-user', seuser: 'staff_u', serange: 's0-s0:c0.c1023', state: 'present' }
921f83
 
921f83
 
921f83
-    - include: set_selinux_variables.yml
921f83
+    - import_tasks: set_selinux_variables.yml
921f83
     - name: save state after initial changes and before other changes
921f83
       set_fact:
921f83
         login_before: "{{ selinux_role_login.stdout }}"
921f83
diff --git a/tests/tests_port.yml b/tests/tests_port.yml
921f83
index 446f79d..7bb112e 100644
921f83
--- a/tests/tests_port.yml
921f83
+++ b/tests/tests_port.yml
921f83
@@ -29,7 +29,7 @@
921f83
         selinux_ports:
921f83
           - { ports: '22022', proto: 'tcp', setype: 'ssh_port_t', state: 'present' }
921f83
 
921f83
-    - include: set_selinux_variables.yml
921f83
+    - import_tasks: set_selinux_variables.yml
921f83
     - name: save state after other changes
921f83
       set_fact:
921f83
         port_after: "{{ selinux_role_port.stdout }}"
921f83
diff --git a/tests/tests_selinux_disabled.yml b/tests/tests_selinux_disabled.yml
921f83
index afd23e4..706882f 100644
921f83
--- a/tests/tests_selinux_disabled.yml
921f83
+++ b/tests/tests_selinux_disabled.yml
921f83
@@ -18,7 +18,9 @@
921f83
         name:
921f83
           - policycoreutils-python-utils
921f83
         state: present
921f83
-      when: ansible_distribution == "Fedora"
921f83
+      when: ansible_distribution == "Fedora" or
921f83
+        ( ansible_distribution_major_version > "7" and
921f83
+          ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
921f83
 
921f83
     - name: Add a Linux System Roles SELinux User
921f83
       user:
921f83
@@ -67,17 +69,28 @@
921f83
       assert:
921f83
         that: "{{ ansible_selinux.config_mode == 'enforcing' }}"
921f83
         msg: "SELinux config mode should be enforcing instead of {{ ansible_selinux.config_mode }}"
921f83
-    - name: Restore original /etc/selinux/config
921f83
-      copy:
921f83
-        remote_src: true
921f83
-        dest: /etc/selinux/config
921f83
-        src: /etc/selinux/config.test_selinux_disabled
921f83
-    - name: Remove /etc/selinux/config backup
921f83
-      file:
921f83
-        path: /etc/selinux/config.test_selinux_disabled
921f83
-        state: absent
921f83
-    - name: Remove Linux System Roles SELinux User
921f83
-      user:
921f83
-        name: sar-user
921f83
-        remove: yes
921f83
-        state: absent
921f83
+
921f83
+    - name: Cleanup
921f83
+      tags: [ 'tests::cleanup' ]
921f83
+      block:
921f83
+        - name: Restore original /etc/selinux/config
921f83
+          copy:
921f83
+            remote_src: true
921f83
+            dest: /etc/selinux/config
921f83
+            src: /etc/selinux/config.test_selinux_disabled
921f83
+
921f83
+        - name: Remove /etc/selinux/config backup
921f83
+          file:
921f83
+            path: /etc/selinux/config.test_selinux_disabled
921f83
+            state: absent
921f83
+
921f83
+        - name: Remove Linux System Roles SELinux User
921f83
+          user:
921f83
+            name: sar-user
921f83
+            remove: yes
921f83
+            state: absent
921f83
+
921f83
+        - import_role:
921f83
+            name: selinux
921f83
+          vars:
921f83
+            selinux_all_purge: true