-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipagroup: Fix management of AD objects
When using AD objects, a user expects to use the more human readable form, like "[email protected]", but this impose some dificulties on evaluating which object is being referenced as AD has several forms to refer to the same object. Each object is AD is identified uniquely by its SID, and this is the identifier that IPA stores in its database. When managing AD objects, IPA finds its SID and works with that value. ansible-freeipa tried to process these objects using the human readable values, and it cause idempontence error when ensuring the values were present or modified, and, at least in some cases, prevented the objects to be made absent, as the object list created didn't match the SID to the value used as module parameter. By using SID to process the AD objects in ipagroup, the addition or removal of members works and idempotence of these members is ensured. The only issue with thils approach is that it only works no server nodes. In client nodes, the conversion to SID is not available and the same issues that existed before will still be present. Tests were updated to reflect these changes, a new test, specific to idempotence issues of AD objects was added: tests/group/test_group_ad_users.yml Resolves: https://issues.redhat.com/browse/RHEL-70023
- Loading branch information
Showing
7 changed files
with
294 additions
and
92 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
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
- name: Test group AD external members idempotence | ||
hosts: ipaserver | ||
become: false | ||
gather_facts: false | ||
module_defaults: | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
ipaapi_context: server # external_member requires 'server' context | ||
|
||
vars: | ||
ad_user: "{{ test_ad_user | default('AD\\aduser') }}" | ||
alt_user: "{{ test_alt_user | default('[email protected]') }}" | ||
|
||
tasks: | ||
- name: Include tasks ../env_freeipa_facts.yml | ||
ansible.builtin.include_tasks: ../env_freeipa_facts.yml | ||
|
||
- name: Ensure test group is absent. | ||
ipagroup: | ||
name: extgroup | ||
state: absent | ||
|
||
- name: Execute group tests if trust test environment is supported | ||
when: trust_test_is_supported | default(false) | ||
block: | ||
- name: Ensure external group, with AD users, is present. | ||
ipagroup: | ||
name: extgroup | ||
external: true | ||
external_member: "{{ ad_user }}" | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Ensure external group, with AD users, is present, again | ||
ipagroup: | ||
name: extgroup | ||
external: true | ||
external_member: "{{ ad_user }}" | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Ensure external group, with alternate name AD users, is present | ||
ipagroup: | ||
name: extgroup | ||
external: true | ||
external_member: "{{ alt_user }}" | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
- name: Ensure external_member is absent | ||
ipagroup: | ||
name: extgroup | ||
external_member: "{{ ad_user }}" | ||
action: member | ||
state: absent | ||
register: result | ||
failed_when: result.failed or not result.changed | ||
|
||
- name: Ensure external_member is absent, again | ||
ipagroup: | ||
name: extgroup | ||
external_member: "{{ alt_user }}" | ||
action: member | ||
state: absent | ||
register: result | ||
failed_when: result.failed or result.changed | ||
|
||
always: | ||
- name: Cleanup environment. | ||
ipagroup: | ||
name: extgroup | ||
state: absent |
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 |
---|---|---|
|
@@ -18,6 +18,15 @@ | |
failed_when: not (result.failed and result.msg is regex("No module named '*ipaserver'*")) | ||
when: ipa_host_is_client | ||
|
||
- name: Ensuref fail if externalmember is used in client context. | ||
ipagroup: | ||
ipaadmin_password: SomeADMINpassword | ||
ipaapi_context: client | ||
name: ThisShouldNotWork | ||
external_member: [email protected] | ||
register: result | ||
failed_when: not (result.failed and result.msg == "Cannot use externalmember in client context.") | ||
|
||
# Import basic module tests, and execute with ipa_context set to 'client'. | ||
# If ipaclients is set, it will be executed using the client, if not, | ||
# ipaserver will be used. | ||
|
Oops, something went wrong.