2021-12-14 10:26:42 +00:00
|
|
|
---
|
|
|
|
- name: Verify
|
|
|
|
hosts: all
|
2022-04-28 09:33:40 +00:00
|
|
|
vars:
|
|
|
|
keycloak_admin_password: "remembertochangeme"
|
|
|
|
keycloak_jvm_package: java-11-openjdk-headless
|
|
|
|
keycloak_port: http://localhost:8080
|
|
|
|
keycloak_management_port: http://localhost:9990
|
2021-12-14 10:26:42 +00:00
|
|
|
tasks:
|
|
|
|
- name: Populate service facts
|
|
|
|
ansible.builtin.service_facts:
|
2021-12-15 11:33:42 +00:00
|
|
|
- name: Check if keycloak service started
|
2022-02-24 14:00:10 +00:00
|
|
|
ansible.builtin.assert:
|
2021-12-14 10:26:42 +00:00
|
|
|
that:
|
|
|
|
- ansible_facts.services["keycloak.service"]["state"] == "running"
|
2022-03-24 18:00:30 +00:00
|
|
|
- ansible_facts.services["keycloak.service"]["status"] == "enabled"
|
2022-04-28 09:33:40 +00:00
|
|
|
- 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
|
2022-04-28 09:58:29 +00:00
|
|
|
register: keycloak_auth_response
|
2022-04-28 09:33:40 +00:00
|
|
|
until: keycloak_auth_response.status == 200
|
|
|
|
retries: 2
|
|
|
|
delay: 2
|