-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipagroup: Correctly handle externalmember in member actions
When creating the lists of external members, the attribute 'ipaexternalmember' also needs to be added to the list of external members that are part of the group object for external groups. A test to verify the correct behavior was added and the test suite for group external members have been cleaned up with 'yes' values changed to 'true' and the use of module_defaults.
- Loading branch information
Showing
2 changed files
with
81 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,156 @@ | ||
--- | ||
- name: Find trust | ||
hosts: ipaserver | ||
become: true | ||
become: false | ||
gather_facts: false | ||
module_defaults: | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
ipaapi_context: "{{ ipa_context | default(omit) }}" | ||
|
||
tasks: | ||
|
||
- name: Include tasks ../env_freeipa_facts.yml | ||
ansible.builtin.include_tasks: ../env_freeipa_facts.yml | ||
|
||
- name: Ensure tests groups are absent | ||
ipagroup: | ||
name: | ||
- extgroup | ||
- extgroup_members | ||
state: absent | ||
|
||
- name: Execute group tests if trust test environment is supported | ||
when: trust_test_is_supported | default(false) | ||
block: | ||
|
||
- name: Add nonposix group. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
nonposix: yes | ||
nonposix: true | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Set group to be external | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
external: yes | ||
external: true | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Add AD users to group | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Add AD users to group, again | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Remove external group | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
state: absent | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Add nonposix, external group, with AD users. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
nonposix: yes | ||
external: yes | ||
nonposix: true | ||
external: true | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Add nonposix, external group, with AD users, again. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
nonposix: yes | ||
external: yes | ||
nonposix: true | ||
external: true | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Remove group | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
state: absent | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Add nonposix group. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
nonposix: yes | ||
nonposix: true | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Set group to be external, and add users. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
external: yes | ||
external: true | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Set group to be external, and add users, again. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
external: yes | ||
external: true | ||
external_member: "AD\\Domain Users" | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Cleanup environment. | ||
- name: Ensure external group for external member exist | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
name: extgroup | ||
name: extgroup_members | ||
external: true | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Ensure external group members are present | ||
ipagroup: | ||
name: extgroup_members | ||
external_member: "AD\\Domain Users" | ||
action: member | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Ensure external group members are present, again | ||
ipagroup: | ||
name: extgroup_members | ||
external_member: "AD\\Domain Users" | ||
action: member | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Ensure external group members are absent | ||
ipagroup: | ||
name: extgroup_members | ||
external_member: "AD\\Domain Users" | ||
action: member | ||
state: absent | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Ensure external group members are present, again | ||
ipagroup: | ||
name: extgroup_members | ||
external_member: "AD\\Domain Users" | ||
action: member | ||
state: absent | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Ensure tests groups are absent | ||
ipagroup: | ||
name: | ||
- extgroup | ||
- extgroup_members | ||
state: absent |