iparole: Add state 'renamed'.

All ansible-freeipa modules which allow object renaming should support
'state: renamed'.

This patch adds suport for the missing state, and fixes cases where a
user could try to rename the object and set its members, which would
fail depending on the operation order.

Fix #566
This commit is contained in:
Rafael Guterres Jeffman
2021-12-29 11:16:55 -03:00
parent b9d0b35e83
commit 68f775842d
2 changed files with 27 additions and 9 deletions

View File

@@ -36,6 +36,7 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: renamerole
rename: testrole
state: renamed
register: result
failed_when: not result.changed or result.failed
@@ -47,8 +48,9 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: renamerole
rename: testrole
state: renamed
register: result
failed_when: result.changed
failed_when: result.changed or (not result.failed and "No role 'renamerole'" not in result.msg)
- name: Ensure role has member has privileges.
iparole: