blob: 74ba85ab83dd1f0a4fb3d7971c0d66b2aed46ebc [file] [log] [blame]
Hung-Wei Chiu6a075af2021-09-09 22:33:06 +00001---
2# keycloak molecule/default/verify.yml
3#
4# SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: Verify
8 hosts: all
9 tasks:
Hung-Wei Chiu718cd262021-09-13 18:20:21 +000010 - name: "Create Token for service Keycloak"
11 uri:
12 url: http://localhost:8080/auth/realms/master/protocol/openid-connect/token
13 method: POST
14 body_format: form-urlencoded
15 body:
16 username: "{{ keycloak_admin_username }}"
17 password: "{{ keycloak_admin_password }}"
18 grant_type: "password"
19 client_id: "admin-cli"
20 register: keycloak_token
21
22 - name: "Get Client List"
23 uri:
24 url: http://localhost:8080/auth/admin/realms/master/clients
25 method: GET
26 headers:
27 Accept: "application/json"
28 Authorization: "Bearer {{ keycloak_token.json.access_token }}"
29 register: keycloak_userlist
30
31 - name: Check if the Keycloak client json output contains our client
32 set_fact:
33 find: true
34 with_items: "{{ keycloak_userlist.json }}"
35 when: item.name == keycloak_client_settings[0].name
36
37 - name: Fail if our client isn't installed correctly
38 assert:
39 that:
40 - find is defined