INF-162 - Configure keycloak client setting via built-in Ansible plugin
Change-Id: Ifd6b43d148a52727e2044c0c4314203fa7711286
diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml
index f05340a..74ba85a 100644
--- a/molecule/default/verify.yml
+++ b/molecule/default/verify.yml
@@ -7,11 +7,34 @@
- name: Verify
hosts: all
tasks:
- - name: Check that Keycloak is running with configured username/password
- community.general.keycloak_client:
- auth_keycloak_url: http://localhost:8080/auth
- auth_realm: master
- auth_username: "{{ keycloak_admin_username }}"
- auth_password: "{{ keycloak_admin_password }}"
- client_id: test
- state: present
+ - 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