community.general
community.general copied to clipboard
New Module: Keycloak User Rolemapping
SUMMARY
Add keycloak_user_rolemapping
module to provide management of direct assignment of client/realm roles to users. Also provides user role mapping for service-account users.
ISSUE TYPE
- New Module Pull Request
COMPONENT NAME
keycloak_user_rolemapping
ADDITIONAL INFORMATION
Example:
- name: Map a client role to a user, authentication with credentials
community.general.keycloak_user_rolemapping:
realm: MyCustomRealm
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com/auth
auth_realm: master
auth_username: USERNAME
auth_password: PASSWORD
state: present
client_id: client1
user_id: user1Id
roles:
- name: role_name1
id: role_id1
- name: role_name2
id: role_id2
delegate_to: localhost
- name: Map a client role to a service account user for a client, authentication with credentials
community.general.keycloak_user_rolemapping:
realm: MyCustomRealm
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com/auth
auth_realm: master
auth_username: USERNAME
auth_password: PASSWORD
state: present
client_id: client1
service_account_user_client_id: clientIdOfServiceAccount
roles:
- name: role_name1
id: role_id1
- name: role_name2
id: role_id2
delegate_to: localhost
@bratwurzt this PR contains the following merge commits:
- https://github.com/ansible-collections/community.general/commit/2b2ba7e349d7f65026041a4728dd88dfbe9df6b1
Please rebase your branch to remove these commits.
The test ansible-test sanity --test pep8
[explain] failed with 5 errors:
plugins/module_utils/identity/keycloak/keycloak.py:574:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:647:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:668:5: E303: too many blank lines (2)
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:71:73: W291: trailing whitespace
tests/unit/plugins/modules/identity/keycloak/test_keycloak_client_rolemapping.py:59:161: E501: line too long (174 > 160 characters)
The test ansible-test sanity --test validate-modules
[explain] failed with 2 errors:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: invalid-documentation: DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Dušan Marković']
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test pep8
[explain] failed with 5 errors:
plugins/module_utils/identity/keycloak/keycloak.py:574:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:647:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:668:5: E303: too many blank lines (2)
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:71:73: W291: trailing whitespace
tests/unit/plugins/modules/identity/keycloak/test_keycloak_client_rolemapping.py:59:161: E501: line too long (174 > 160 characters)
The test ansible-test sanity --test pep8
[explain] failed with 5 errors:
plugins/module_utils/identity/keycloak/keycloak.py:574:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:647:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:668:5: E303: too many blank lines (2)
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:71:73: W291: trailing whitespace
tests/unit/plugins/modules/identity/keycloak/test_keycloak_client_rolemapping.py:59:161: E501: line too long (174 > 160 characters)
The test ansible-test sanity --test pep8
[explain] failed with 5 errors:
plugins/module_utils/identity/keycloak/keycloak.py:574:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:647:5: E303: too many blank lines (2)
plugins/module_utils/identity/keycloak/keycloak.py:668:5: E303: too many blank lines (2)
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:71:73: W291: trailing whitespace
tests/unit/plugins/modules/identity/keycloak/test_keycloak_client_rolemapping.py:59:161: E501: line too long (174 > 160 characters)
The test ansible-test sanity --test validate-modules
[explain] failed with 2 errors:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: invalid-documentation: DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Dušan Marković']
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test validate-modules
[explain] failed with 2 errors:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: invalid-documentation: DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Dušan Marković']
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test validate-modules
[explain] failed with 2 errors:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: invalid-documentation: DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Dušan Marković']
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
@bratwurzt This PR was evaluated as a potentially problematic PR for the following reasons:
- More than 50 changed files.
Such PR can only be merged by human. Contact a Core team member to review this PR on IRC: #ansible-devel
on Libera.chat IRC
@bratwurzt this PR contains the following merge commits:
- https://github.com/ansible-collections/community.general/commit/bb23ad0386bef1568c3ab788a0dbfeec75f79658
Please rebase your branch to remove these commits.
cc @Gaetan2907 @eikef @ndclt click here for bot help
The test botmeta
failed with 1 error:
.github/BOTMETA.yml:0:0: Entry plugins/modules/identity/keycloak/keycloak_role_composites.py was not used
The test ansible-test sanity --test validate-modules
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/identity/keycloak/keycloak.py:696:41: undefined-variable: Undefined variable 'cid'
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:792:47: E127: continuation line over-indented for visual indent
plugins/module_utils/identity/keycloak/keycloak.py:810:43: E127: continuation line over-indented for visual indent
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:792:47: E127: continuation line over-indented for visual indent
plugins/module_utils/identity/keycloak/keycloak.py:810:43: E127: continuation line over-indented for visual indent
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:792:47: E127: continuation line over-indented for visual indent
plugins/module_utils/identity/keycloak/keycloak.py:810:43: E127: continuation line over-indented for visual indent
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/identity/keycloak/keycloak.py:696:41: undefined-variable: Undefined variable 'cid'
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:792:47: E127: continuation line over-indented for visual indent
plugins/module_utils/identity/keycloak/keycloak.py:810:43: E127: continuation line over-indented for visual indent
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/identity/keycloak/keycloak.py:696:41: undefined-variable: Undefined variable 'cid'
The test ansible-test sanity --test validate-modules
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test validate-modules
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test validate-modules
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: parameter-documented-multiple-times: Argument 'auth_username' in argument_spec with aliases 'username' is documented multiple times, namely as 'auth_username', 'username'
The test ansible-test sanity --test pylint
[explain] failed with 1 error:
plugins/module_utils/identity/keycloak/keycloak.py:696:41: undefined-variable: Undefined variable 'cid'
Docs Build 📝
Thank you for contribution!✨
This PR has been merged and your docs changes will be incorporated when they are next published.
The test ansible-test sanity --test pep8
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:259:161: E501: line too long (167 > 160 characters)
The test ansible-test sanity --test pep8
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:259:161: E501: line too long (167 > 160 characters)
The test ansible-test sanity --test pep8
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:259:161: E501: line too long (167 > 160 characters)
The test ansible-test sanity --test pep8
[explain] failed with 1 error:
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:259:161: E501: line too long (167 > 160 characters)
Could anyone help out on parameter naming? I'm quite bad at that.
@bratwurzt this PR contains the following merge commits:
- https://github.com/ansible-collections/community.general/commit/2c6d066fe13ef519f709e9b77da89cfeca884298
Please rebase your branch to remove these commits.
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:809:21: E117: over-indented
plugins/module_utils/identity/keycloak/keycloak.py:827:21: E117: over-indented
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:809:21: E117: over-indented
plugins/module_utils/identity/keycloak/keycloak.py:827:21: E117: over-indented
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:809:21: E117: over-indented
plugins/module_utils/identity/keycloak/keycloak.py:827:21: E117: over-indented
The test ansible-test sanity --test pep8
[explain] failed with 2 errors:
plugins/module_utils/identity/keycloak/keycloak.py:809:21: E117: over-indented
plugins/module_utils/identity/keycloak/keycloak.py:827:21: E117: over-indented
The test licenses
failed with 8 errors:
tests/integration/targets/keycloak_user_rolemapping/aliases:0:0: found copyright line with "Copyright:". Please remove the colon.
tests/integration/targets/keycloak_user_rolemapping/aliases:0:0: found no copyright notice
tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml:0:0: found copyright line with "Copyright:". Please remove the colon.
tests/integration/targets/keycloak_user_rolemapping/tasks/main.yml:0:0: found no copyright notice
tests/integration/targets/keycloak_user_rolemapping/vars/main.yml:0:0: found copyright line with "Copyright:". Please remove the colon.
tests/integration/targets/keycloak_user_rolemapping/vars/main.yml:0:0: found no copyright notice
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: found copyright line with "Copyright:". Please remove the colon.
plugins/modules/identity/keycloak/keycloak_user_rolemapping.py:0:0: found no copyright notice
Backport to stable-5: 💚 backport PR created
✅ Backport PR branch: patchback/backports/stable-5/2cac3ae879172c59149637a80c4597b1a2e156de/pr-4898
Backported as https://github.com/ansible-collections/community.general/pull/5324
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
@bratwurzt thanks a lot for your contribution, and sorry that it took so long to get it merged!
@bratwurzt thanks a lot for your contribution, and sorry that it took so long to get it merged!
No worries, glad I could contribute.