Blame SOURCES/selinux-tier1-tags.diff

cc4018
diff --git a/tests/set_selinux_variables.yml b/tests/set_selinux_variables.yml
cc4018
index f294101..7571066 100644
cc4018
--- a/tests/set_selinux_variables.yml
cc4018
+++ b/tests/set_selinux_variables.yml
cc4018
@@ -1,4 +1,12 @@
cc4018
 ---
cc4018
+- name: Install SELinux tool semanage on Fedora
cc4018
+  package:
cc4018
+    name:
cc4018
+      - policycoreutils-python-utils
cc4018
+    state: present
cc4018
+  when: ansible_distribution == "Fedora" or
cc4018
+    ( ansible_distribution_major_version > "7" and
cc4018
+      ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
cc4018
 - name: Get local modifications - boolean
cc4018
   command: /usr/sbin/semanage boolean -l -n -C
cc4018
   register: selinux_role_boolean
cc4018
diff --git a/tests/tests_boolean.yml b/tests/tests_boolean.yml
cc4018
index 47eafc0..ca85922 100644
cc4018
--- a/tests/tests_boolean.yml
cc4018
+++ b/tests/tests_boolean.yml
cc4018
@@ -1,5 +1,6 @@
cc4018
 
cc4018
 - name: Check if selinux role sets SELinux booleans
cc4018
+  tags: [ 'tests::tier1', 'tests::expfail' ]
cc4018
   hosts: all
cc4018
   become: true
cc4018
 
cc4018
@@ -12,7 +13,7 @@
cc4018
         selinux_booleans:
cc4018
           - { name: 'samba_enable_home_dirs', state: 'on', persistent: 'yes' }
cc4018
 
cc4018
-    - include: set_selinux_variables.yml
cc4018
+    - import_tasks: set_selinux_variables.yml
cc4018
     - name: save state after initial changes and before other changes
cc4018
       set_fact:
cc4018
         boolean_before: "{{ selinux_role_boolean.stdout_lines }}"
cc4018
diff --git a/tests/tests_default.yml b/tests/tests_default.yml
cc4018
index a837c73..25bf39d 100644
cc4018
--- a/tests/tests_default.yml
cc4018
+++ b/tests/tests_default.yml
cc4018
@@ -1,5 +1,6 @@
cc4018
 
cc4018
 - name: Ensure that the role runs with default parameters
cc4018
+  tags: tests::tier1
cc4018
   hosts: all
cc4018
 
cc4018
   roles:
cc4018
diff --git a/tests/tests_default_vars.yml b/tests/tests_default_vars.yml
cc4018
index b6a6b5a..7cd321d 100644
cc4018
--- a/tests/tests_default_vars.yml
cc4018
+++ b/tests/tests_default_vars.yml
cc4018
@@ -1,4 +1,5 @@
cc4018
 - name: Ensure that the role declares all paremeters in defaults
cc4018
+  tags: tests::tier1
cc4018
   hosts: all
cc4018
 
cc4018
   roles:
cc4018
diff --git a/tests/tests_fcontext.yml b/tests/tests_fcontext.yml
cc4018
index 0a411fb..f4a3923 100644
cc4018
--- a/tests/tests_fcontext.yml
cc4018
+++ b/tests/tests_fcontext.yml
cc4018
@@ -1,5 +1,6 @@
cc4018
 
cc4018
 - name: Check if selinux role sets SELinux fcontext mappings
cc4018
+  tags: tests::tier1
cc4018
   hosts: all
cc4018
   become: true
cc4018
 
cc4018
@@ -13,7 +14,7 @@
cc4018
         selinux_fcontexts:
cc4018
           - { target: '/tmp/test_dir1(/.*)?', setype: 'user_home_dir_t', ftype: 'd' }
cc4018
 
cc4018
-    - include: set_selinux_variables.yml
cc4018
+    - import_tasks: set_selinux_variables.yml
cc4018
     - name: save state after initial changes and before other changes
cc4018
       set_fact:
cc4018
         fcontext_before: "{{ selinux_role_fcontext.stdout }}"
cc4018
diff --git a/tests/tests_login.yml b/tests/tests_login.yml
cc4018
index efa826d..e4f55ca 100644
cc4018
--- a/tests/tests_login.yml
cc4018
+++ b/tests/tests_login.yml
cc4018
@@ -1,5 +1,6 @@
cc4018
 
cc4018
 - name: Check if selinux role sets SELinux login mappings
cc4018
+  tags: tests::tier1
cc4018
   hosts: all
cc4018
   become: true
cc4018
 
cc4018
@@ -18,7 +19,7 @@
cc4018
           - { login: 'sar-user', seuser: 'staff_u', serange: 's0-s0:c0.c1023', state: 'present' }
cc4018
 
cc4018
 
cc4018
-    - include: set_selinux_variables.yml
cc4018
+    - import_tasks: set_selinux_variables.yml
cc4018
     - name: save state after initial changes and before other changes
cc4018
       set_fact:
cc4018
         login_before: "{{ selinux_role_login.stdout }}"
cc4018
diff --git a/tests/tests_port.yml b/tests/tests_port.yml
cc4018
index 446f79d..03276b5 100644
cc4018
--- a/tests/tests_port.yml
cc4018
+++ b/tests/tests_port.yml
cc4018
@@ -1,5 +1,6 @@
cc4018
 
cc4018
 - name: Check if selinux role sets SELinux port mapping
cc4018
+  tags: tests::tier1
cc4018
   hosts: all
cc4018
   become: true
cc4018
 
cc4018
@@ -29,7 +30,7 @@
cc4018
         selinux_ports:
cc4018
           - { ports: '22022', proto: 'tcp', setype: 'ssh_port_t', state: 'present' }
cc4018
 
cc4018
-    - include: set_selinux_variables.yml
cc4018
+    - import_tasks: set_selinux_variables.yml
cc4018
     - name: save state after other changes
cc4018
       set_fact:
cc4018
         port_after: "{{ selinux_role_port.stdout }}"
cc4018
diff --git a/tests/tests_selinux_disabled.yml b/tests/tests_selinux_disabled.yml
cc4018
index afd23e4..d30de2b 100644
cc4018
--- a/tests/tests_selinux_disabled.yml
cc4018
+++ b/tests/tests_selinux_disabled.yml
cc4018
@@ -18,7 +19,9 @@
cc4018
         name:
cc4018
           - policycoreutils-python-utils
cc4018
         state: present
cc4018
-      when: ansible_distribution == "Fedora"
cc4018
+      when: ansible_distribution == "Fedora" or
cc4018
+        ( ansible_distribution_major_version > "7" and
cc4018
+          ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ))
cc4018
 
cc4018
     - name: Add a Linux System Roles SELinux User
cc4018
       user:
cc4018
@@ -67,17 +71,28 @@
cc4018
       assert:
cc4018
         that: "{{ ansible_selinux.config_mode == 'enforcing' }}"
cc4018
         msg: "SELinux config mode should be enforcing instead of {{ ansible_selinux.config_mode }}"
cc4018
-    - name: Restore original /etc/selinux/config
cc4018
-      copy:
cc4018
-        remote_src: true
cc4018
-        dest: /etc/selinux/config
cc4018
-        src: /etc/selinux/config.test_selinux_disabled
cc4018
-    - name: Remove /etc/selinux/config backup
cc4018
-      file:
cc4018
-        path: /etc/selinux/config.test_selinux_disabled
cc4018
-        state: absent
cc4018
-    - name: Remove Linux System Roles SELinux User
cc4018
-      user:
cc4018
-        name: sar-user
cc4018
-        remove: yes
cc4018
-        state: absent
cc4018
+
cc4018
+    - name: Cleanup
cc4018
+      tags: [ 'tests::cleanup' ]
cc4018
+      block:
cc4018
+        - name: Restore original /etc/selinux/config
cc4018
+          copy:
cc4018
+            remote_src: true
cc4018
+            dest: /etc/selinux/config
cc4018
+            src: /etc/selinux/config.test_selinux_disabled
cc4018
+
cc4018
+        - name: Remove /etc/selinux/config backup
cc4018
+          file:
cc4018
+            path: /etc/selinux/config.test_selinux_disabled
cc4018
+            state: absent
cc4018
+
cc4018
+        - name: Remove Linux System Roles SELinux User
cc4018
+          user:
cc4018
+            name: sar-user
cc4018
+            remove: yes
cc4018
+            state: absent
cc4018
+
cc4018
+        - import_role:
cc4018
+            name: selinux
cc4018
+          vars:
cc4018
+            selinux_all_purge: true