From 28f36ae25c233d294e266c250e8cf34e02445857 Mon Sep 17 00:00:00 2001 From: Chris Northwood Date: Mon, 23 Dec 2024 17:51:34 +0000 Subject: [PATCH] Add action group for keycloak (#9284) * Create group for keycloak This will allows keycloak authentication details to be set as a module_defaults rather than repeated on each task * add documentation to keycloak modules to note creation of action_group * add changelog for keycloak action_group creation * exclude keycloak_realm_info from action group, as it does not share same set of base parameters * fix formatting on changelog entry for adding Keycloak action group Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- .../9284-add-keycloak-action-group.yml | 2 ++ meta/runtime.yml | 28 +++++++++++++++++++ plugins/doc_fragments/keycloak.py | 10 +++++++ plugins/modules/keycloak_authentication.py | 3 ++ ...eycloak_authentication_required_actions.py | 3 ++ .../keycloak_authz_authorization_scope.py | 3 ++ .../modules/keycloak_authz_custom_policy.py | 3 ++ plugins/modules/keycloak_authz_permission.py | 3 ++ .../modules/keycloak_authz_permission_info.py | 5 ++++ plugins/modules/keycloak_client.py | 3 ++ .../modules/keycloak_client_rolemapping.py | 3 ++ plugins/modules/keycloak_client_rolescope.py | 3 ++ plugins/modules/keycloak_clientscope.py | 3 ++ plugins/modules/keycloak_clientscope_type.py | 3 ++ plugins/modules/keycloak_clientsecret_info.py | 5 ++++ .../keycloak_clientsecret_regenerate.py | 3 ++ plugins/modules/keycloak_clienttemplate.py | 3 ++ plugins/modules/keycloak_component.py | 3 ++ plugins/modules/keycloak_component_info.py | 6 ++++ plugins/modules/keycloak_group.py | 3 ++ plugins/modules/keycloak_identity_provider.py | 3 ++ plugins/modules/keycloak_realm.py | 3 ++ plugins/modules/keycloak_realm_key.py | 3 ++ .../keycloak_realm_keys_metadata_info.py | 5 ++++ plugins/modules/keycloak_realm_rolemapping.py | 3 ++ plugins/modules/keycloak_role.py | 3 ++ plugins/modules/keycloak_user.py | 3 ++ plugins/modules/keycloak_user_federation.py | 3 ++ plugins/modules/keycloak_user_rolemapping.py | 3 ++ plugins/modules/keycloak_userprofile.py | 3 ++ 30 files changed, 130 insertions(+) create mode 100644 changelogs/fragments/9284-add-keycloak-action-group.yml diff --git a/changelogs/fragments/9284-add-keycloak-action-group.yml b/changelogs/fragments/9284-add-keycloak-action-group.yml new file mode 100644 index 0000000000..b25c370346 --- /dev/null +++ b/changelogs/fragments/9284-add-keycloak-action-group.yml @@ -0,0 +1,2 @@ +minor_changes: + - keycloak - add an action group for Keycloak modules to allow ``module_defaults`` to be set for Keycloak tasks (https://github.com/ansible-collections/community.general/pull/9284). diff --git a/meta/runtime.yml b/meta/runtime.yml index 387ab0f22b..5b3bb0b6f0 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -32,6 +32,34 @@ action_groups: - proxmox_template - proxmox_user_info - proxmox_vm_info + keycloak: + - keycloak_authentication + - keycloak_authentication_required_actions + - keycloak_authz_authorization_scope + - keycloak_authz_custom_policy + - keycloak_authz_permission + - keycloak_authz_permission_info + - keycloak_client + - keycloak_client_rolemapping + - keycloak_client_rolescope + - keycloak_clientscope + - keycloak_clientscope_type + - keycloak_clientsecret_info + - keycloak_clientsecret_regenerate + - keycloak_clienttemplate + - keycloak_component + - keycloak_component_info + - keycloak_group + - keycloak_identity_provider + - keycloak_realm + - keycloak_realm_key + - keycloak_realm_keys_metadata_info + - keycloak_realm_rolemapping + - keycloak_role + - keycloak_user + - keycloak_user_federation + - keycloak_user_rolemapping + - keycloak_userprofile plugin_routing: callback: actionable: diff --git a/plugins/doc_fragments/keycloak.py b/plugins/doc_fragments/keycloak.py index 9b21ce52c9..b64a23b088 100644 --- a/plugins/doc_fragments/keycloak.py +++ b/plugins/doc_fragments/keycloak.py @@ -77,3 +77,13 @@ options: default: Ansible version_added: 5.4.0 ''' + + ACTIONGROUP_KEYCLOAK = r""" +options: {} +attributes: + action_group: + description: Use C(group/community.general.keycloak) in C(module_defaults) to set defaults for this module. + support: full + membership: + - community.general.keycloak +""" diff --git a/plugins/modules/keycloak_authentication.py b/plugins/modules/keycloak_authentication.py index 5945890bb7..fa2ae1e974 100644 --- a/plugins/modules/keycloak_authentication.py +++ b/plugins/modules/keycloak_authentication.py @@ -24,6 +24,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: realm: @@ -102,6 +104,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_authentication_required_actions.py b/plugins/modules/keycloak_authentication_required_actions.py index 5ffbd2033c..c992e05d2d 100644 --- a/plugins/modules/keycloak_authentication_required_actions.py +++ b/plugins/modules/keycloak_authentication_required_actions.py @@ -26,6 +26,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: realm: @@ -77,6 +79,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_authz_authorization_scope.py b/plugins/modules/keycloak_authz_authorization_scope.py index 5eef9ac765..146a37bf51 100644 --- a/plugins/modules/keycloak_authz_authorization_scope.py +++ b/plugins/modules/keycloak_authz_authorization_scope.py @@ -35,6 +35,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -74,6 +76,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_authz_custom_policy.py b/plugins/modules/keycloak_authz_custom_policy.py index 8363c252e2..2205a184f5 100644 --- a/plugins/modules/keycloak_authz_custom_policy.py +++ b/plugins/modules/keycloak_authz_custom_policy.py @@ -36,6 +36,8 @@ attributes: support: full diff_mode: support: none + action_group: + version_added: 10.2.0 options: state: @@ -71,6 +73,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_authz_permission.py b/plugins/modules/keycloak_authz_permission.py index ef81fb8c31..08b5ae6295 100644 --- a/plugins/modules/keycloak_authz_permission.py +++ b/plugins/modules/keycloak_authz_permission.py @@ -43,6 +43,8 @@ attributes: support: full diff_mode: support: none + action_group: + version_added: 10.2.0 options: state: @@ -121,6 +123,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_authz_permission_info.py b/plugins/modules/keycloak_authz_permission_info.py index 8b4e96b416..4c1a6ddf66 100644 --- a/plugins/modules/keycloak_authz_permission_info.py +++ b/plugins/modules/keycloak_authz_permission_info.py @@ -31,6 +31,10 @@ description: The Authorization Services paths and payloads have not officially been documented by the Keycloak project. U(https://www.puppeteers.net/blog/keycloak-authorization-services-rest-api-paths-and-payload/) +attributes: + action_group: + version_added: 10.2.0 + options: name: description: @@ -51,6 +55,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes - community.general.attributes.info_module diff --git a/plugins/modules/keycloak_client.py b/plugins/modules/keycloak_client.py index 62015bc79f..c65105ec23 100644 --- a/plugins/modules/keycloak_client.py +++ b/plugins/modules/keycloak_client.py @@ -35,6 +35,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -595,6 +597,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_client_rolemapping.py b/plugins/modules/keycloak_client_rolemapping.py index be419904a7..ebc60b9fd0 100644 --- a/plugins/modules/keycloak_client_rolemapping.py +++ b/plugins/modules/keycloak_client_rolemapping.py @@ -38,6 +38,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -130,6 +132,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_client_rolescope.py b/plugins/modules/keycloak_client_rolescope.py index cca72f0ddd..cd4f0fa80e 100644 --- a/plugins/modules/keycloak_client_rolescope.py +++ b/plugins/modules/keycloak_client_rolescope.py @@ -34,6 +34,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -76,6 +78,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_clientscope.py b/plugins/modules/keycloak_clientscope.py index 35ac3d9500..87437b6df0 100644 --- a/plugins/modules/keycloak_clientscope.py +++ b/plugins/modules/keycloak_clientscope.py @@ -38,6 +38,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -158,6 +160,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_clientscope_type.py b/plugins/modules/keycloak_clientscope_type.py index 1fb9a0813c..d95ab0b44d 100644 --- a/plugins/modules/keycloak_clientscope_type.py +++ b/plugins/modules/keycloak_clientscope_type.py @@ -30,6 +30,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: realm: @@ -59,6 +61,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_clientsecret_info.py b/plugins/modules/keycloak_clientsecret_info.py index c772620351..58786a5364 100644 --- a/plugins/modules/keycloak_clientsecret_info.py +++ b/plugins/modules/keycloak_clientsecret_info.py @@ -32,6 +32,10 @@ description: - "Note that this module returns the client secret. To avoid this showing up in the logs, please add C(no_log: true) to the task." +attributes: + action_group: + version_added: 10.2.0 + options: realm: type: str @@ -57,6 +61,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes - community.general.attributes.info_module diff --git a/plugins/modules/keycloak_clientsecret_regenerate.py b/plugins/modules/keycloak_clientsecret_regenerate.py index 7e8b295433..fc279f6a9d 100644 --- a/plugins/modules/keycloak_clientsecret_regenerate.py +++ b/plugins/modules/keycloak_clientsecret_regenerate.py @@ -37,6 +37,8 @@ attributes: support: full diff_mode: support: none + action_group: + version_added: 10.2.0 options: realm: @@ -63,6 +65,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_clienttemplate.py b/plugins/modules/keycloak_clienttemplate.py index 7bffb5cbb6..63bb32f972 100644 --- a/plugins/modules/keycloak_clienttemplate.py +++ b/plugins/modules/keycloak_clienttemplate.py @@ -33,6 +33,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -168,6 +170,7 @@ notes: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_component.py b/plugins/modules/keycloak_component.py index 375953c3e8..6c345700ae 100644 --- a/plugins/modules/keycloak_component.py +++ b/plugins/modules/keycloak_component.py @@ -32,6 +32,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -72,6 +74,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_component_info.py b/plugins/modules/keycloak_component_info.py index a788735d98..cc0c4d31d9 100644 --- a/plugins/modules/keycloak_component_info.py +++ b/plugins/modules/keycloak_component_info.py @@ -18,6 +18,11 @@ version_added: 8.2.0 description: - This module retrive information on component from Keycloak. + +attributes: + action_group: + version_added: 10.2.0 + options: realm: description: @@ -46,6 +51,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes - community.general.attributes.info_module diff --git a/plugins/modules/keycloak_group.py b/plugins/modules/keycloak_group.py index 5398a4b5d0..24564f2d4d 100644 --- a/plugins/modules/keycloak_group.py +++ b/plugins/modules/keycloak_group.py @@ -36,6 +36,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -114,6 +116,7 @@ notes: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_identity_provider.py b/plugins/modules/keycloak_identity_provider.py index 609673653b..0ef67ee385 100644 --- a/plugins/modules/keycloak_identity_provider.py +++ b/plugins/modules/keycloak_identity_provider.py @@ -31,6 +31,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -277,6 +279,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_realm.py b/plugins/modules/keycloak_realm.py index 747acf3081..e190e7ad7b 100644 --- a/plugins/modules/keycloak_realm.py +++ b/plugins/modules/keycloak_realm.py @@ -37,6 +37,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -516,6 +518,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_realm_key.py b/plugins/modules/keycloak_realm_key.py index edc8a6068e..159fb77d4b 100644 --- a/plugins/modules/keycloak_realm_key.py +++ b/plugins/modules/keycloak_realm_key.py @@ -43,6 +43,8 @@ attributes: support: full diff_mode: support: partial + action_group: + version_added: 10.2.0 options: state: @@ -138,6 +140,7 @@ notes: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_realm_keys_metadata_info.py b/plugins/modules/keycloak_realm_keys_metadata_info.py index ef4048b891..9b490fad58 100644 --- a/plugins/modules/keycloak_realm_keys_metadata_info.py +++ b/plugins/modules/keycloak_realm_keys_metadata_info.py @@ -23,6 +23,10 @@ description: - The names of module options are snake_cased versions of the camelCase ones found in the Keycloak API and its documentation at U(https://www.keycloak.org/docs-api/latest/rest-api/index.html). +attributes: + action_group: + version_added: 10.2.0 + options: realm: type: str @@ -32,6 +36,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes - community.general.attributes.info_module diff --git a/plugins/modules/keycloak_realm_rolemapping.py b/plugins/modules/keycloak_realm_rolemapping.py index 693cf9894a..0c24b2f949 100644 --- a/plugins/modules/keycloak_realm_rolemapping.py +++ b/plugins/modules/keycloak_realm_rolemapping.py @@ -40,6 +40,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -118,6 +120,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_role.py b/plugins/modules/keycloak_role.py index f3e01483f8..3978260189 100644 --- a/plugins/modules/keycloak_role.py +++ b/plugins/modules/keycloak_role.py @@ -35,6 +35,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -116,6 +118,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_user.py b/plugins/modules/keycloak_user.py index 1aeff0da5f..cb63707402 100644 --- a/plugins/modules/keycloak_user.py +++ b/plugins/modules/keycloak_user.py @@ -212,12 +212,15 @@ options: default: false extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes attributes: check_mode: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 notes: - The module does not modify the user ID of an existing user. author: diff --git a/plugins/modules/keycloak_user_federation.py b/plugins/modules/keycloak_user_federation.py index 215aa7f4ca..4533fa800d 100644 --- a/plugins/modules/keycloak_user_federation.py +++ b/plugins/modules/keycloak_user_federation.py @@ -31,6 +31,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -513,6 +515,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_user_rolemapping.py b/plugins/modules/keycloak_user_rolemapping.py index 59727a346e..40e3b38d5c 100644 --- a/plugins/modules/keycloak_user_rolemapping.py +++ b/plugins/modules/keycloak_user_rolemapping.py @@ -37,6 +37,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -110,6 +112,7 @@ options: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: diff --git a/plugins/modules/keycloak_userprofile.py b/plugins/modules/keycloak_userprofile.py index 57e1c42e96..ba9cae8554 100644 --- a/plugins/modules/keycloak_userprofile.py +++ b/plugins/modules/keycloak_userprofile.py @@ -28,6 +28,8 @@ attributes: support: full diff_mode: support: full + action_group: + version_added: 10.2.0 options: state: @@ -270,6 +272,7 @@ notes: extends_documentation_fragment: - community.general.keycloak + - community.general.keycloak.actiongroup_keycloak - community.general.attributes author: