blob: 74ba85ab83dd1f0a4fb3d7971c0d66b2aed46ebc [file] [log] [blame]
---
# keycloak molecule/default/verify.yml
#
# SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: Verify
hosts: all
tasks:
- name: "Create Token for service Keycloak"
uri:
url: http://localhost:8080/auth/realms/master/protocol/openid-connect/token
method: POST
body_format: form-urlencoded
body:
username: "{{ keycloak_admin_username }}"
password: "{{ keycloak_admin_password }}"
grant_type: "password"
client_id: "admin-cli"
register: keycloak_token
- name: "Get Client List"
uri:
url: http://localhost:8080/auth/admin/realms/master/clients
method: GET
headers:
Accept: "application/json"
Authorization: "Bearer {{ keycloak_token.json.access_token }}"
register: keycloak_userlist
- name: Check if the Keycloak client json output contains our client
set_fact:
find: true
with_items: "{{ keycloak_userlist.json }}"
when: item.name == keycloak_client_settings[0].name
- name: Fail if our client isn't installed correctly
assert:
that:
- find is defined