diff --git a/playbooks/roles/matrix-gerritbot/README.rst b/playbooks/roles/matrix-gerritbot/README.rst index 9c3b54b79f..2983cf2f10 100644 --- a/playbooks/roles/matrix-gerritbot/README.rst +++ b/playbooks/roles/matrix-gerritbot/README.rst @@ -22,3 +22,13 @@ Delete the token: .. code-block:: curl -H "Authorization: Bearer ${MATRIX_TOKEN}" -X POST ${HOMESERVER_URL}/_matrix/client/r0/logout -d{} + +Create the *gerritbot_matrix_identity_token* with this command: + +.. code-block:: + + MATRIX_OPENID=$(curl -XPOST ${HOMESERVER_URL}/_matrix/client/r0/user/${USER}/openid/request_token -H "Authorization: Bearer ${MATRIX_TOKEN}" -d '{}') + IDENTITY_URL="https://matrix.org" + + export MATRIX_IDENTITY_TOKEN=$(curl -XPOST ${IDENTITY_URL}/_matrix/identity/v2/account/register -d "${MATRIX_OPENID}" | jq -r '.access_token') + echo "gerritbot_matrix_identity_token: ${MATRIX_IDENTITY_TOKEN}" diff --git a/playbooks/roles/matrix-gerritbot/defaults/main.yaml b/playbooks/roles/matrix-gerritbot/defaults/main.yaml index 49e4abce89..48bec62b35 100644 --- a/playbooks/roles/matrix-gerritbot/defaults/main.yaml +++ b/playbooks/roles/matrix-gerritbot/defaults/main.yaml @@ -15,3 +15,5 @@ gerritbot_gerrit_user: "gerritbot" # matrix configuration gerritbot_matrix_homeserver: "https://opendev.ems.host" gerritbot_matrix_access_token: "" +gerritbot_matrix_identityserver: "https://matrix.org" +gerritbot_matrix_identity_token: "" diff --git a/playbooks/roles/matrix-gerritbot/templates/docker-compose.yaml.j2 b/playbooks/roles/matrix-gerritbot/templates/docker-compose.yaml.j2 index 20fd774b61..0f0b1d97fa 100644 --- a/playbooks/roles/matrix-gerritbot/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/matrix-gerritbot/templates/docker-compose.yaml.j2 @@ -13,6 +13,7 @@ services: tag: "docker-matrix-gerritbot" environment: MATRIX_TOKEN: {{ gerritbot_matrix_access_token }} + MATRIX_IDENTITY_TOKEN: {{ gerritbot_matrix_identity_token }} volumes: - /var/lib/matrix-gerritbot/config:/config - /var/lib/matrix-gerritbot/ssh:/root/.ssh @@ -24,5 +25,6 @@ services: --gerrit-host {{ gerritbot_gerrit_host }} --gerrit-user {{ gerritbot_gerrit_user }} --homeserver-url {{ gerritbot_matrix_homeserver }} + --identity-url {{ gerritbot_matrix_identityserver }} --config-file /config/gerritbot.dhall --monitoring-port {{ gerritbot_matrix_prometheus_port }}