community.general.keycloak_realm_info (8.5.0) — module

Allows obtaining Keycloak realm public information via Keycloak API

| "added in version" 4.3.0 of community.general"

Authors: Fynn Chen (@fynncfchen)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module allows you to get Keycloak realm public information via the Keycloak REST API.

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/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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get a Keycloak public key
  community.general.keycloak_realm_info:
    realm: MyCustomRealm
    auth_keycloak_url: https://auth.example.com/auth
  delegate_to: localhost

Inputs

    
realm:
    default: master
    description:
    - They Keycloak realm ID.
    type: str

validate_certs:
    default: true
    description:
    - Verify TLS certificates (do not disable this in production).
    type: bool

auth_keycloak_url:
    aliases:
    - url
    description:
    - URL to the Keycloak instance.
    required: true
    type: str

Outputs

msg:
  description: Message as to what action was taken.
  returned: always
  type: str
realm_info:
  contains:
    account-service:
      description: Account console URL.
      returned: always
      sample: https://auth.example.com/auth/realms/MyRealm/account
      type: str
    public_key:
      description: Public key of the realm.
      returned: always
      sample: MIIBIjANBgkqhkiG9w0BAQEFAAO...
      type: str
    realm:
      description: Realm ID.
      returned: always
      sample: MyRealm
      type: str
    token-service:
      description: Token endpoint URL.
      returned: always
      sample: https://auth.example.com/auth/realms/MyRealm/protocol/openid-connect
      type: str
    tokens-not-before:
      description: The token not before.
      returned: always
      sample: 0
      type: int
  description:
  - Representation of the realm public information.
  returned: always
  type: dict