update molecule test and verify for jvm

main
Guido Grazioli 2022-04-28 11:33:40 +02:00
parent e3bb10d901
commit 9987f6a044
No known key found for this signature in database
GPG Key ID: 22C8C31EF2BC093B
3 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,7 @@
hosts: all hosts: all
vars: vars:
keycloak_admin_password: "remembertochangeme" keycloak_admin_password: "remembertochangeme"
keycloak_jvm_package: java-11-openjdk-headless
roles: roles:
- role: keycloak - role: keycloak
tasks: tasks:

View File

@ -8,5 +8,7 @@
- name: Install sudo - name: Install sudo
ansible.builtin.yum: ansible.builtin.yum:
name: sudo name:
- sudo
- java-1.8.0-openjdk
state: present state: present

View File

@ -1,6 +1,11 @@
--- ---
- name: Verify - name: Verify
hosts: all 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: tasks:
- name: Populate service facts - name: Populate service facts
ansible.builtin.service_facts: ansible.builtin.service_facts:
@ -9,3 +14,15 @@
that: that:
- ansible_facts.services["keycloak.service"]["state"] == "running" - ansible_facts.services["keycloak.service"]["state"] == "running"
- ansible_facts.services["keycloak.service"]["status"] == "enabled" - 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