mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-04-08 20:00:29 -07:00
add molecule quarkus keycloak in dev-mode test
This commit is contained in:
parent
bef20b6a57
commit
942b5fce0f
5 changed files with 141 additions and 0 deletions
44
molecule/quarkus-devmode/converge.yml
Normal file
44
molecule/quarkus-devmode/converge.yml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
keycloak_quarkus_admin_pass: "remembertochangeme"
|
||||||
|
keycloak_admin_password: "remembertochangeme"
|
||||||
|
keycloak_realm: TestRealm
|
||||||
|
keycloak_quarkus_http_relative_path: ''
|
||||||
|
keycloak_quarkus_log: file
|
||||||
|
keycloak_quarkus_frontend_url: 'http://localhost:8080/'
|
||||||
|
keycloak_quarkus_start_dev: True
|
||||||
|
keycloak_quarkus_proxy_mode: none
|
||||||
|
roles:
|
||||||
|
- role: keycloak_quarkus
|
||||||
|
- role: keycloak_realm
|
||||||
|
keycloak_context: ''
|
||||||
|
keycloak_client_default_roles:
|
||||||
|
- TestRoleAdmin
|
||||||
|
- TestRoleUser
|
||||||
|
keycloak_client_users:
|
||||||
|
- username: TestUser
|
||||||
|
password: password
|
||||||
|
client_roles:
|
||||||
|
- client: TestClient
|
||||||
|
role: TestRoleUser
|
||||||
|
realm: "{{ keycloak_realm }}"
|
||||||
|
- username: TestAdmin
|
||||||
|
password: password
|
||||||
|
client_roles:
|
||||||
|
- client: TestClient
|
||||||
|
role: TestRoleUser
|
||||||
|
realm: "{{ keycloak_realm }}"
|
||||||
|
- client: TestClient
|
||||||
|
role: TestRoleAdmin
|
||||||
|
realm: "{{ keycloak_realm }}"
|
||||||
|
keycloak_realm: TestRealm
|
||||||
|
keycloak_clients:
|
||||||
|
- name: TestClient
|
||||||
|
roles: "{{ keycloak_client_default_roles }}"
|
||||||
|
realm: "{{ keycloak_realm }}"
|
||||||
|
public_client: "{{ keycloak_client_public }}"
|
||||||
|
web_origins: "{{ keycloak_client_web_origins }}"
|
||||||
|
users: "{{ keycloak_client_users }}"
|
||||||
|
client_id: TestClient
|
45
molecule/quarkus-devmode/molecule.yml
Normal file
45
molecule/quarkus-devmode/molecule.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: registry.access.redhat.com/ubi8/ubi-init:latest
|
||||||
|
pre_build_image: true
|
||||||
|
privileged: true
|
||||||
|
command: "/usr/sbin/init"
|
||||||
|
port_bindings:
|
||||||
|
- "8080/tcp"
|
||||||
|
- "8009/tcp"
|
||||||
|
published_ports:
|
||||||
|
- 0.0.0.0:8080:8080/tcp
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
config_options:
|
||||||
|
defaults:
|
||||||
|
interpreter_python: auto_silent
|
||||||
|
ssh_connection:
|
||||||
|
pipelining: false
|
||||||
|
playbooks:
|
||||||
|
prepare: prepare.yml
|
||||||
|
converge: converge.yml
|
||||||
|
verify: verify.yml
|
||||||
|
inventory:
|
||||||
|
host_vars:
|
||||||
|
localhost:
|
||||||
|
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
||||||
|
env:
|
||||||
|
ANSIBLE_FORCE_COLOR: "true"
|
||||||
|
verifier:
|
||||||
|
name: ansible
|
||||||
|
scenario:
|
||||||
|
test_sequence:
|
||||||
|
- cleanup
|
||||||
|
- destroy
|
||||||
|
- create
|
||||||
|
- prepare
|
||||||
|
- converge
|
||||||
|
- idempotence
|
||||||
|
- side_effect
|
||||||
|
- verify
|
||||||
|
- cleanup
|
||||||
|
- destroy
|
12
molecule/quarkus-devmode/prepare.yml
Normal file
12
molecule/quarkus-devmode/prepare.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: Install sudo
|
||||||
|
ansible.builtin.yum:
|
||||||
|
name: sudo
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: "Display hera_home if defined."
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
hera_home: "{{ lookup('env', 'HERA_HOME') }}"
|
1
molecule/quarkus-devmode/roles
Symbolic link
1
molecule/quarkus-devmode/roles
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../roles
|
39
molecule/quarkus-devmode/verify.yml
Normal file
39
molecule/quarkus-devmode/verify.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
- name: Verify
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: Populate service facts
|
||||||
|
ansible.builtin.service_facts:
|
||||||
|
|
||||||
|
- name: Check if keycloak service started
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ansible_facts.services["keycloak.service"]["state"] == "running"
|
||||||
|
- ansible_facts.services["keycloak.service"]["status"] == "enabled"
|
||||||
|
|
||||||
|
- name: Set internal envvar
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
hera_home: "{{ lookup('env', 'HERA_HOME') }}"
|
||||||
|
|
||||||
|
- name: Verify openid config
|
||||||
|
block:
|
||||||
|
- name: Fetch openID config # noqa blocked_modules command-instead-of-module
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
set -o pipefail
|
||||||
|
curl http://localhost:8080/realms/master/.well-known/openid-configuration -k | jq .
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
delegate_to: localhost
|
||||||
|
register: openid_config
|
||||||
|
changed_when: False
|
||||||
|
- name: Verify endpoint URLs
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'http://localhost:8080/realms/master/protocol/openid-connect/ext/ciba/auth'
|
||||||
|
- (openid_config.stdout | from_json)['issuer'] == 'http://localhost:8080/realms/master'
|
||||||
|
- (openid_config.stdout | from_json)['authorization_endpoint'] == 'http://localhost:8080/realms/master/protocol/openid-connect/auth'
|
||||||
|
- (openid_config.stdout | from_json)['token_endpoint'] == 'http://localhost:8080/realms/master/protocol/openid-connect/token'
|
||||||
|
delegate_to: localhost
|
||||||
|
when:
|
||||||
|
- hera_home is defined
|
||||||
|
- hera_home | length == 0
|
Loading…
Add table
Reference in a new issue