From 3fe41a52601bdacdc75bd1a998d535cae7420e9d Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Fri, 24 Nov 2023 16:25:41 -0300 Subject: [PATCH] tests/group: Use module_defaults on tests_group Use module_defaults to improve reading test cases. --- tests/group/test_group.yml | 91 +++----------------------------------- 1 file changed, 7 insertions(+), 84 deletions(-) diff --git a/tests/group/test_group.yml b/tests/group/test_group.yml index 8f6a0fa97f..743a791694 100644 --- a/tests/group/test_group.yml +++ b/tests/group/test_group.yml @@ -3,6 +3,13 @@ hosts: "{{ ipa_test_host | default('ipaserver') }}" become: true gather_facts: true + module_defaults: + ipauser: + ipaadmin_password: SomeADMINpassword + ipaapi_context: "{{ ipa_context | default(omit) }}" + ipagroup: + ipaadmin_password: SomeADMINpassword + ipaapi_context: "{{ ipa_context | default(omit) }}" tasks: # setup @@ -19,15 +26,11 @@ - name: Ensure users user1, user2 and user3 are absent ipauser: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: user1,user2,user3 state: absent - name: Ensure group group3, group2 and group1 are absent ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group3,group2,group1 state: absent @@ -35,8 +38,6 @@ - name: Ensure users user1..user3 are present ipauser: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" users: - name: user1 first: user1 @@ -54,56 +55,42 @@ - name: Ensure group1 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 register: result failed_when: not result.changed or result.failed - name: Ensure group1 is present again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 register: result failed_when: result.changed or result.failed - name: Ensure group2 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group2 register: result failed_when: not result.changed or result.failed - name: Ensure group2 is present again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group2 register: result failed_when: result.changed or result.failed - name: Ensure group3 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group3 register: result failed_when: not result.changed or result.failed - name: Ensure group3 is present again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group3 register: result failed_when: result.changed or result.failed - name: Ensure groups group2 and group3 are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 group: - group2 @@ -114,8 +101,6 @@ - name: Ensure groups group2 and group3 are present in group group1 again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 group: - group2 @@ -126,8 +111,6 @@ - name: Ensure group3 ia present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 group: - group3 @@ -143,8 +126,6 @@ - name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -154,8 +135,6 @@ - name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -165,8 +144,6 @@ - name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'ldap/' + fqdn_at_domain }}" @@ -176,8 +153,6 @@ - name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is present in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'ldap/' + fqdn_at_domain }}" @@ -187,8 +162,6 @@ - name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is absent in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -199,8 +172,6 @@ - name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is absent in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -211,8 +182,6 @@ - name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is absent in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'ldap/' + fqdn_at_domain }}" @@ -223,8 +192,6 @@ - name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is absent in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'ldap/' + fqdn_at_domain }}" @@ -235,8 +202,6 @@ - name: Ensure services are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -247,8 +212,6 @@ - name: Ensure services are present in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'http/' + fqdn_at_domain }}" @@ -259,8 +222,6 @@ - name: Ensure services are absent in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -272,8 +233,6 @@ - name: Ensure services are absent in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 service: - "{{ 'HTTP/' + fqdn_at_domain }}" @@ -287,8 +246,6 @@ - name: Ensure users user1, user2 and user3 are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -300,8 +257,6 @@ - name: Ensure users user1, user2 and user3 are present in group group1 again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -312,8 +267,6 @@ failed_when: result.changed or result.failed #- ipagroup: - # ipaadmin_password: SomeADMINpassword - # ipaapi_context: "{{ ipa_context | default(omit) }}" # name: group1 # user: # - user7 @@ -321,8 +274,6 @@ - name: Ensure user user7 is absent in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user7 @@ -333,8 +284,6 @@ - name: Ensure group group4 is absent ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group4 state: absent register: result @@ -342,8 +291,6 @@ - name: Ensure groups group3, group2, and group1 are absent ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group3,group2,group1 state: absent register: result @@ -351,16 +298,12 @@ - name: Ensure group group1 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 register: result failed_when: not result.changed or result.failed - name: Ensure users user1, user2 are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -371,8 +314,6 @@ - name: Ensure users user1, user2 and user3 are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -384,8 +325,6 @@ - name: Ensure users user1, user2 are present in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -396,8 +335,6 @@ - name: Ensure users user1, user2 and user3 are present in group group1, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -409,8 +346,6 @@ - name: Ensure group group1 is absent ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 state: absent register: result @@ -418,8 +353,6 @@ - name: Ensure group group1 with users user1, user2 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -429,8 +362,6 @@ - name: Ensure group group1 with users user1, user2 and user3 is present ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -441,8 +372,6 @@ - name: Ensure group group1 with users user1, user2 and user3 is present, again ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -454,8 +383,6 @@ - name: Ensure only users user1, user2 are present in group group1 ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group1 user: - user1 @@ -467,8 +394,6 @@ - name: Ensure group group3, group2 and group1 are absent ipagroup: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: group3,group2,group1 state: absent register: result @@ -476,8 +401,6 @@ - name: Ensure users user1, user2 and user3 are absent ipauser: - ipaadmin_password: SomeADMINpassword - ipaapi_context: "{{ ipa_context | default(omit) }}" name: user1,user2,user3 state: absent register: result