.. Document meta :orphan: .. |antsibull-internal-nbsp| unicode:: 0xA0 :trim: .. role:: ansible-attribute-support-label .. role:: ansible-attribute-support-property .. role:: ansible-attribute-support-full .. role:: ansible-attribute-support-partial .. role:: ansible-attribute-support-none .. role:: ansible-attribute-support-na .. role:: ansible-option-type .. role:: ansible-option-elements .. role:: ansible-option-required .. role:: ansible-option-versionadded .. role:: ansible-option-aliases .. role:: ansible-option-choices .. role:: ansible-option-choices-default-mark .. role:: ansible-option-default-bold .. role:: ansible-option-configuration .. role:: ansible-option-returned-bold .. role:: ansible-option-sample-bold .. Anchors .. _ansible_collections.middleware_automation.keycloak.keycloak_role_module: .. Anchors: short name for ansible.builtin .. Title keycloak_role -- Allows administration of Keycloak roles via Keycloak API +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. Collection note .. note:: This module is part of the `middleware_automation.keycloak collection `_. To install it, use: :code:`ansible-galaxy collection install middleware\_automation.keycloak`. To use it in a playbook, specify: :code:`middleware_automation.keycloak.keycloak_role`. .. version_added .. rst-class:: ansible-version-added New in middleware\_automation.keycloak 3.4.0 .. contents:: :local: :depth: 1 .. Deprecated Synopsis -------- .. Description - This module allows you to add, remove or modify Keycloak roles via the Keycloak REST API. It requires access to the REST API via OpenID Connect; the user connecting and the client being used must have the requisite access rights. In a default Keycloak installation, admin-cli and an admin user would work, as would a separate client definition with the scope tailored to your needs and a user having the expected roles. - The names of module options are snake\_cased versions of the camelCase ones found in the Keycloak API and its documentation at \ https://www.keycloak.org/docs-api/8.0/rest-api/index.html\ . - Attributes are multi-valued in the Keycloak API. All attributes are lists of individual values and will be returned that way by this module. You may pass single values for attributes when calling the module, and this will be translated into a list suitable for the API. .. Aliases .. Requirements .. Options Parameters ---------- .. rst-class:: ansible-option-table .. list-table:: :width: 100% :widths: auto :header-rows: 1 * - Parameter - Comments * - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-attributes: .. rst-class:: ansible-option-title **attributes** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
A dict of key/value pairs to set as custom attributes for the role. Values may be single values (e.g. a string) or a list of strings. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_client_id: .. rst-class:: ansible-option-title **auth_client_id** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
OpenID Connect \ :emphasis:`client\_id`\ to authenticate to the API with. .. rst-class:: ansible-option-line :ansible-option-default-bold:`Default:` :ansible-option-default:`"admin-cli"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_client_secret: .. rst-class:: ansible-option-title **auth_client_secret** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Client Secret to use in conjunction with \ :emphasis:`auth\_client\_id`\ (if required). .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_keycloak_url: .. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-url: .. rst-class:: ansible-option-title **auth_keycloak_url** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-aliases:`aliases: url` .. rst-class:: ansible-option-type-line :ansible-option-type:`string` / :ansible-option-required:`required` .. raw:: html
- .. raw:: html
URL to the Keycloak instance. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_password: .. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-password: .. rst-class:: ansible-option-title **auth_password** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-aliases:`aliases: password` .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Password to authenticate for API access with. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_realm: .. rst-class:: ansible-option-title **auth_realm** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Keycloak realm name to authenticate to for API access. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-auth_username: .. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-username: .. rst-class:: ansible-option-title **auth_username** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-aliases:`aliases: username` .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Username to authenticate for API access with. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-client_id: .. rst-class:: ansible-option-title **client_id** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
If the role is a client role, the client id under which it resides. If this parameter is absent, the role is considered a realm role. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-connection_timeout: .. rst-class:: ansible-option-title **connection_timeout** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`integer` :ansible-option-versionadded:`added in middleware\_automation.keycloak 4.5.0` .. raw:: html
- .. raw:: html
Controls the HTTP connections timeout period (in seconds) to Keycloak API. .. rst-class:: ansible-option-line :ansible-option-default-bold:`Default:` :ansible-option-default:`10` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-description: .. rst-class:: ansible-option-title **description** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
The role description. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-http_agent: .. rst-class:: ansible-option-title **http_agent** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` :ansible-option-versionadded:`added in middleware\_automation.keycloak 5.4.0` .. raw:: html
- .. raw:: html
Configures the HTTP User-Agent header. .. rst-class:: ansible-option-line :ansible-option-default-bold:`Default:` :ansible-option-default:`"Ansible"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-name: .. rst-class:: ansible-option-title **name** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` / :ansible-option-required:`required` .. raw:: html
- .. raw:: html
Name of the role. This parameter is required. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-realm: .. rst-class:: ansible-option-title **realm** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
The Keycloak realm under which this role resides. .. rst-class:: ansible-option-line :ansible-option-default-bold:`Default:` :ansible-option-default:`"master"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-state: .. rst-class:: ansible-option-title **state** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
State of the role. On \ :literal:`present`\ , the role will be created if it does not yet exist, or updated with the parameters you provide. On \ :literal:`absent`\ , the role will be removed if it exists. .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry-default:`"present"` :ansible-option-choices-default-mark:`← (default)` - :ansible-option-choices-entry:`"absent"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-token: .. rst-class:: ansible-option-title **token** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` :ansible-option-versionadded:`added in middleware\_automation.keycloak 3.0.0` .. raw:: html
- .. raw:: html
Authentication token for Keycloak API. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__parameter-validate_certs: .. rst-class:: ansible-option-title **validate_certs** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`boolean` .. raw:: html
- .. raw:: html
Verify TLS certificates (do not disable this in production). .. rst-class:: ansible-option-line :ansible-option-choices:`Choices:` - :ansible-option-choices-entry:`false` - :ansible-option-choices-entry-default:`true` :ansible-option-choices-default-mark:`← (default)` .. raw:: html
.. Attributes Attributes ---------- .. rst-class:: ansible-option-table .. list-table:: :width: 100% :widths: auto :header-rows: 1 * - Attribute - Support - Description * - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__attribute-check_mode: .. rst-class:: ansible-option-title **check_mode** .. raw:: html .. raw:: html
- .. raw:: html
:ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full` .. raw:: html
- .. raw:: html
Can run in \ :literal:`check\_mode`\ and return changed status prediction without modifying target. .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__attribute-diff_mode: .. rst-class:: ansible-option-title **diff_mode** .. raw:: html .. raw:: html
- .. raw:: html
:ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full` .. raw:: html
- .. raw:: html
Will return details on what has changed (or possibly needs changing in \ :literal:`check\_mode`\ ), when in diff mode. .. raw:: html
.. Notes .. Seealso .. Examples Examples -------- .. code-block:: yaml+jinja - name: Create a Keycloak realm role, authentication with credentials middleware_automation.keycloak.keycloak_role: name: my-new-kc-role realm: MyCustomRealm state: present auth_client_id: admin-cli auth_keycloak_url: https://auth.example.com/auth auth_realm: master auth_username: USERNAME auth_password: PASSWORD delegate_to: localhost - name: Create a Keycloak realm role, authentication with token middleware_automation.keycloak.keycloak_role: name: my-new-kc-role realm: MyCustomRealm state: present auth_client_id: admin-cli auth_keycloak_url: https://auth.example.com/auth token: TOKEN delegate_to: localhost - name: Create a Keycloak client role middleware_automation.keycloak.keycloak_role: name: my-new-kc-role realm: MyCustomRealm client_id: MyClient state: present auth_client_id: admin-cli auth_keycloak_url: https://auth.example.com/auth auth_realm: master auth_username: USERNAME auth_password: PASSWORD delegate_to: localhost - name: Delete a Keycloak role middleware_automation.keycloak.keycloak_role: name: my-role-for-deletion state: absent auth_client_id: admin-cli auth_keycloak_url: https://auth.example.com/auth auth_realm: master auth_username: USERNAME auth_password: PASSWORD delegate_to: localhost - name: Create a keycloak role with some custom attributes middleware_automation.keycloak.keycloak_role: auth_client_id: admin-cli auth_keycloak_url: https://auth.example.com/auth auth_realm: master auth_username: USERNAME auth_password: PASSWORD name: my-new-role attributes: attrib1: value1 attrib2: value2 attrib3: - with - numerous - individual - list - items delegate_to: localhost .. Facts .. Return values Return Values ------------- Common return values are documented :ref:`here `, the following are the fields unique to this module: .. rst-class:: ansible-option-table .. list-table:: :width: 100% :widths: auto :header-rows: 1 * - Key - Description * - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__return-end_state: .. rst-class:: ansible-option-title **end_state** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
Representation of role after module execution (sample is truncated). .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` on success .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`{"attributes": {}, "clientRole": true, "composite": false, "containerId": "9f03eb61-a826-4771-a9fd-930e06d2d36a", "description": "My updated client test role", "id": "561703dd-0f38-45ff-9a5a-0c978f794547", "name": "myrole"}` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__return-existing: .. rst-class:: ansible-option-title **existing** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
Representation of existing role. .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` always .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`{"attributes": {}, "clientRole": true, "composite": false, "containerId": "9f03eb61-a826-4771-a9fd-930e06d2d36a", "description": "My client test role", "id": "561703dd-0f38-45ff-9a5a-0c978f794547", "name": "myrole"}` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__return-msg: .. rst-class:: ansible-option-title **msg** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`string` .. raw:: html
- .. raw:: html
Message as to what action was taken. .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` always .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`"Role myrole has been updated"` .. raw:: html
* - .. raw:: html
.. _ansible_collections.middleware_automation.keycloak.keycloak_role_module__return-proposed: .. rst-class:: ansible-option-title **proposed** .. raw:: html .. rst-class:: ansible-option-type-line :ansible-option-type:`dictionary` .. raw:: html
- .. raw:: html
Representation of proposed role. .. rst-class:: ansible-option-line :ansible-option-returned-bold:`Returned:` always .. rst-class:: ansible-option-line .. rst-class:: ansible-option-sample :ansible-option-sample-bold:`Sample:` :ansible-rv-sample-value:`{"description": "My updated test description"}` .. raw:: html
.. Status (Presently only deprecated) .. Authors Authors ~~~~~~~ - Laurent Paumier (@laurpaum) .. Extra links .. Parsing errors