From 9987f6a0444478f7d4b1bef3fe95fa6e4529f915 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Thu, 28 Apr 2022 11:33:40 +0200 Subject: [PATCH] update molecule test and verify for jvm --- molecule/default/converge.yml | 1 + molecule/default/prepare.yml | 4 +++- molecule/default/verify.yml | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 938aaa0..7e73d70 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,6 +3,7 @@ hosts: all vars: keycloak_admin_password: "remembertochangeme" + keycloak_jvm_package: java-11-openjdk-headless roles: - role: keycloak tasks: diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 03433c0..8137cfd 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -8,5 +8,7 @@ - name: Install sudo ansible.builtin.yum: - name: sudo + name: + - sudo + - java-1.8.0-openjdk state: present diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index ef973cd..8bd5b6f 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -1,6 +1,11 @@ --- - name: Verify hosts: all + vars: + keycloak_admin_password: "remembertochangeme" + keycloak_jvm_package: java-11-openjdk-headless + keycloak_port: http://localhost:8080 + keycloak_management_port: http://localhost:9990 tasks: - name: Populate service facts ansible.builtin.service_facts: @@ -9,3 +14,15 @@ that: - ansible_facts.services["keycloak.service"]["state"] == "running" - ansible_facts.services["keycloak.service"]["status"] == "enabled" + - name: Verify we are running on requested jvm + shell: | + ps -ef | grep /usr/lib/jvm/java-11 | grep -v grep + - name: Verify token api call + ansible.builtin.uri: + url: "{{ keycloak_port }}/auth/realms/master/protocol/openid-connect/token" + method: POST + body: "client_id=admin-cli&username=admin&password={{ keycloak_admin_password }}&grant_type=password" + validate_certs: no + until: keycloak_auth_response.status == 200 + retries: 2 + delay: 2 \ No newline at end of file