diff --git a/tests/group/test_group_idoverrideuser.yml b/tests/group/test_group_idoverrideuser.yml
index e468b88b446404f0c77fedfe501621239270c79c..71d640a688f9868d368d281a69a53c0974eb7a46 100644
--- a/tests/group/test_group_idoverrideuser.yml
+++ b/tests/group/test_group_idoverrideuser.yml
@@ -103,4 +103,4 @@
           kdestroy -A -q -c idoverride_cache
         when:
 
-      when: ipa_version is version("4.8.7", ">=")  and trust_test_is_supported | default(false)
+      when: ipa_version is version("4.8.7", ">=") and trust_test_is_supported | default(false)
diff --git a/tests/hbacrule/test_hbacrule_member_case_insensitive.yml b/tests/hbacrule/test_hbacrule_member_case_insensitive.yml
index 160f871315c7ab3d4f159e0fe3d7dddef2fbfc1a..e37163de7880e4d7d88bac002b5f8c02cde83c90 100644
--- a/tests/hbacrule/test_hbacrule_member_case_insensitive.yml
+++ b/tests/hbacrule/test_hbacrule_member_case_insensitive.yml
@@ -193,7 +193,7 @@
           - "{{ hbacsvc_list[0] | upper }}"
           - "{{ hbacsvc_list[1] | upper }}"
           hbacsvcgroup:
-          - "{{ hbacsvcgroup_list[0] | upper  }}"
+          - "{{ hbacsvcgroup_list[0] | upper }}"
         register: result
         failed_when: result.changed or result.failed
 
diff --git a/tests/netgroup/test_netgroup_member_case_insensitive.yml b/tests/netgroup/test_netgroup_member_case_insensitive.yml
index e98100fef58c9340277394ad088f96f38dd74534..7a0968c07c5b3a55d0f0e37c7d35252e9f0adc9b 100644
--- a/tests/netgroup/test_netgroup_member_case_insensitive.yml
+++ b/tests/netgroup/test_netgroup_member_case_insensitive.yml
@@ -92,11 +92,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipaserver_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
-        netgroup: "netgroup{{ item  | lower }}"
+        hostgroup: "hostgroup{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipaserver_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
+        netgroup: "netgroup{{ item | lower }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
@@ -106,11 +106,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipaserver_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
-        netgroup: "netgroup{{ item  | upper }}"
+        hostgroup: "hostgroup{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipaserver_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
+        netgroup: "netgroup{{ item | upper }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
@@ -135,11 +135,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipaserver_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
-        netgroup: "netgroup{{ item  | lower }}"
+        hostgroup: "hostgroup{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipaserver_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
+        netgroup: "netgroup{{ item | lower }}"
         action: member
         state: absent
       loop: "{{ groups_present }}"
@@ -150,11 +150,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipaserver_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
-        netgroup: "netgroup{{ item  | upper }}"
+        hostgroup: "hostgroup{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipaserver_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
+        netgroup: "netgroup{{ item | upper }}"
         action: member
         state: absent
       loop: "{{ groups_present }}"
@@ -165,11 +165,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipaserver_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
-        netgroup: "netgroup{{ item  | upper }}"
+        hostgroup: "hostgroup{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipaserver_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
+        netgroup: "netgroup{{ item | upper }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
@@ -179,11 +179,11 @@
       ipanetgroup:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "hostgroup{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipaserver_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
-        netgroup: "netgroup{{ item  | lower }}"
+        hostgroup: "hostgroup{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipaserver_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
+        netgroup: "netgroup{{ item | lower }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
diff --git a/tests/permission/test_permission.yml b/tests/permission/test_permission.yml
index 99054644abb58c5fb9c827cbcccee89ec99dc5ca..5b27a769fe5c9c53062a6cb050d555615f0ffcdb 100644
--- a/tests/permission/test_permission.yml
+++ b/tests/permission/test_permission.yml
@@ -247,7 +247,7 @@
     register: result
     failed_when: result.changed or result.failed
 
-  - name: Ensure attributes carlicense and displayname are present in permission "System{{':'}} Update DNS Entries"
+  - name: Ensure attributes carlicense and displayname are present in permission "System{{ ':' }} Update DNS Entries"
     ipapermission:
       ipaadmin_password: SomeADMINpassword
       ipaapi_context: "{{ ipa_context | default(omit) }}"
@@ -259,7 +259,7 @@
     register: result
     failed_when: not result.changed or result.failed
 
-  - name: Ensure attributes carlicense and displayname are present in permission "System{{':'}} Update DNS Entries" again
+  - name: Ensure attributes carlicense and displayname are present in permission "System{{ ':' }} Update DNS Entries" again
     ipapermission:
       ipaadmin_password: SomeADMINpassword
       ipaapi_context: "{{ ipa_context | default(omit) }}"
@@ -271,7 +271,7 @@
     register: result
     failed_when: result.changed or result.failed
 
-  - name: Ensure attributes carlicense and displayname are present in permission "System{{':'}} Update DNS Entries"
+  - name: Ensure attributes carlicense and displayname are present in permission "System{{ ':' }} Update DNS Entries"
     ipapermission:
       ipaadmin_password: SomeADMINpassword
       ipaapi_context: "{{ ipa_context | default(omit) }}"
@@ -284,7 +284,7 @@
     register: result
     failed_when: not result.changed or result.failed
 
-  - name: Ensure attributes carlicense and displayname are present in permission "System{{':'}} Update DNS Entries" again
+  - name: Ensure attributes carlicense and displayname are present in permission "System{{ ':' }} Update DNS Entries" again
     ipapermission:
       ipaadmin_password: SomeADMINpassword
       ipaapi_context: "{{ ipa_context | default(omit) }}"
diff --git a/tests/pwpolicy/test_pwpolicy.yml b/tests/pwpolicy/test_pwpolicy.yml
index 9d60a92c17999659a98e0147878e00e19c16d5e3..871406fbeb7a479f3d958a96c4f19da2439eee5f 100644
--- a/tests/pwpolicy/test_pwpolicy.yml
+++ b/tests/pwpolicy/test_pwpolicy.yml
@@ -176,12 +176,10 @@
       minlength: ""
     register: result
     failed_when:
-        result.changed or (
-            result.failed and not (
-                "an internal error has occurred" in result.msg
-                or "int() argument must be" in result.msg
-            )
-        )
+        result.changed or
+        (result.failed and not
+            ("an internal error has occurred" in result.msg or
+             "int() argument must be" in result.msg))
     when: ipa_version is version("4.9", ">=")
 
   - name: Ensure minlength is not cleared due to FreeIPA issue
diff --git a/tests/sudocmdgroup/test_sudocmdgroup.yml b/tests/sudocmdgroup/test_sudocmdgroup.yml
index 39f222f888076f5b05b19537a4c640851773e9fa..ae0441b7a783a494ee4cf0be0dffeb3ad225a65a 100644
--- a/tests/sudocmdgroup/test_sudocmdgroup.yml
+++ b/tests/sudocmdgroup/test_sudocmdgroup.yml
@@ -88,7 +88,7 @@
       KRB5CCNAME="verify_sudocmdgroup" ipa sudocmdgroup-show network --all
       kdestroy -A -q -c verify_sudocmdgroup
     register: result
-    failed_when: result.failed or not("/usr/sbin/ifconfig" in result.stdout and "/usr/sbin/iwlist" in result.stdout)
+    failed_when: result.failed or not ("/usr/sbin/ifconfig" in result.stdout and "/usr/sbin/iwlist" in result.stdout)
 
   - name: Ensure sudocmdgroup, with sudocmds, is absent
     ipasudocmdgroup:
diff --git a/tests/sudorule/test_sudorule_member_case_insensitive.yml b/tests/sudorule/test_sudorule_member_case_insensitive.yml
index 582e8204eb5248feb77f94a7ccf1e9a8e1a81b55..cc212406a4fc3fde88c6d6fbec32d0a3b0eaa444 100644
--- a/tests/sudorule/test_sudorule_member_case_insensitive.yml
+++ b/tests/sudorule/test_sudorule_member_case_insensitive.yml
@@ -147,10 +147,10 @@
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
         cmdcategory: all
-        hostgroup: "{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipa_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
+        hostgroup: "{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipa_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
       loop: "{{ groups_present }}"
       register: result
       failed_when: result.failed or result.changed
@@ -160,10 +160,10 @@
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
         cmdcategory: all
-        hostgroup: "{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipa_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
+        hostgroup: "{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipa_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
       loop: "{{ groups_present }}"
       register: result
       failed_when: result.failed or result.changed
@@ -186,10 +186,10 @@
       ipasudorule:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipa_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
+        hostgroup: "{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipa_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
         action: member
         state: absent
       loop: "{{ groups_present }}"
@@ -200,10 +200,10 @@
       ipasudorule:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipa_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
+        hostgroup: "{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipa_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
         action: member
         state: absent
       loop: "{{ groups_present }}"
@@ -214,10 +214,10 @@
       ipasudorule:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "{{ item  | upper }}"
-        host: "{{ item  | upper }}.{{ ipa_domain }}"
-        group: "{{ item  | upper }}"
-        user: "user{{ item  | upper }}"
+        hostgroup: "{{ item | upper }}"
+        host: "{{ item | upper }}.{{ ipa_domain }}"
+        group: "{{ item | upper }}"
+        user: "user{{ item | upper }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
@@ -227,10 +227,10 @@
       ipasudorule:
         ipaadmin_password: SomeADMINpassword
         name: "{{ item }}"
-        hostgroup: "{{ item  | lower }}"
-        host: "{{ item  | lower }}.{{ ipa_domain }}"
-        group: "{{ item  | lower }}"
-        user: "user{{ item  | lower }}"
+        hostgroup: "{{ item | lower }}"
+        host: "{{ item | lower }}.{{ ipa_domain }}"
+        group: "{{ item | lower }}"
+        user: "user{{ item | lower }}"
         action: member
       loop: "{{ groups_present }}"
       register: result
diff --git a/tests/user/test_users_absent.yml b/tests/user/test_users_absent.yml
index 23670510ed8cf35b050df6923cb6b34766b5b924..59a15feaa2b73f6917a6e8779c1193fd0eef5467 100644
--- a/tests/user/test_users_absent.yml
+++ b/tests/user/test_users_absent.yml
@@ -14,7 +14,7 @@
 
   - name: Create dict with user names
     ansible.builtin.set_fact:
-      user_names: "{{ user_names | default([]) + [{ 'name': item.name }] }}"
+      user_names: "{{ user_names | default([]) + [{'name': item.name}] }}"
     loop: "{{ users }}"
 
   - name: Users absent len:{{ users | length }}
diff --git a/tests/user/test_users_present_slice.yml b/tests/user/test_users_present_slice.yml
index 904be415ae8c13342a7c0345805807160c0e4900..c3274974d5bd9df84a303169c0d4dc11397ac664 100644
--- a/tests/user/test_users_present_slice.yml
+++ b/tests/user/test_users_present_slice.yml
@@ -19,5 +19,5 @@
   - name: Users present
     ipauser:
       ipaadmin_password: SomeADMINpassword
-      users: "{{ users[item:item+slice_size] }}"
-    loop: "{{ range(0,users | length, slice_size) | list }}"
+      users: "{{ users[item : item + slice_size] }}"
+    loop: "{{ range(0, users | length, slice_size) | list }}"
diff --git a/tests/vault/test_vault_symmetric.yml b/tests/vault/test_vault_symmetric.yml
index 89ee142482f067b9f0ee7023a113926b9e968002..344ea69157f4a97996b81e35d3a93a01045f0426 100644
--- a/tests/vault/test_vault_symmetric.yml
+++ b/tests/vault/test_vault_symmetric.yml
@@ -267,7 +267,7 @@
       salt: MTIzNDU2Nzg5MDEyMzQ1Ngo=
       new_password: SomeVAULTpassword
     register: result
-    failed_when: not result.failed and  "Vault `salt` can only change when changing the password." not in result.msg
+    failed_when: not result.failed and "Vault `salt` can only change when changing the password." not in result.msg
 
   - name: Try to change symmetric vault salt, without providing `new_password`
     ipavault:
@@ -276,7 +276,7 @@
       salt: MTIzNDU2Nzg5MDEyMzQ1Ngo=
       password: SomeVAULTpassword
     register: result
-    failed_when: not result.failed and  "Vault `salt` can only change when changing the password." not in result.msg
+    failed_when: not result.failed and "Vault `salt` can only change when changing the password." not in result.msg
 
   - name: Try to change symmetric vault salt, using wrong password.
     ipavault: