mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2025-08-03 12:44:31 -07:00
update test config
This commit is contained in:
parent
0a5fc3ae25
commit
476bc0ec0b
10 changed files with 18 additions and 8 deletions
48
molecule/quarkus_devmode/converge.yml
Normal file
48
molecule/quarkus_devmode/converge.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
keycloak_quarkus_show_deprecation_warnings: false
|
||||
keycloak_quarkus_bootstrap_admin_password: "remembertochangeme"
|
||||
keycloak_quarkus_bootstrap_admin_user: "remembertochangeme"
|
||||
keycloak_realm: TestRealm
|
||||
keycloak_quarkus_log: file
|
||||
keycloak_quarkus_hostname: 'http://localhost:8080'
|
||||
keycloak_quarkus_start_dev: True
|
||||
keycloak_quarkus_proxy_mode: none
|
||||
keycloak_quarkus_java_home: /opt/openjdk/
|
||||
roles:
|
||||
- role: keycloak_quarkus
|
||||
- role: keycloak_realm
|
||||
keycloak_url: "{{ keycloak_quarkus_hostname }}"
|
||||
keycloak_context: ''
|
||||
keycloak_admin_user: "{{ keycloak_quarkus_bootstrap_admin_user }}"
|
||||
keycloak_admin_password: "{{ keycloak_quarkus_bootstrap_admin_password }}"
|
||||
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
|
49
molecule/quarkus_devmode/molecule.yml
Normal file
49
molecule/quarkus_devmode/molecule.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
driver:
|
||||
name: podman
|
||||
platforms:
|
||||
- name: instance
|
||||
image: registry.access.redhat.com/ubi9/ubi-init:latest
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
command: "/usr/sbin/init"
|
||||
port_bindings:
|
||||
- "8080/tcp"
|
||||
- "8009/tcp"
|
||||
- "9000/tcp"
|
||||
published_ports:
|
||||
- 0.0.0.0:8080:8080/tcp
|
||||
- 0.0.0.0:9000:9000/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"
|
||||
PROXY: "${PROXY}"
|
||||
NO_PROXY: "${NO_PROXY}"
|
||||
verifier:
|
||||
name: ansible
|
||||
scenario:
|
||||
test_sequence:
|
||||
- cleanup
|
||||
- destroy
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- idempotence
|
||||
- side_effect
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
49
molecule/quarkus_devmode/prepare.yml
Normal file
49
molecule/quarkus_devmode/prepare.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Install sudo
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- sudo
|
||||
- openjdk-17-jdk-headless
|
||||
state: present
|
||||
when:
|
||||
- ansible_facts.os_family == 'Debian'
|
||||
|
||||
- name: "Ensure common prepare phase are set."
|
||||
ansible.builtin.include_tasks: ../prepare.yml
|
||||
|
||||
- name: Install JDK17
|
||||
become: yes
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- java-17-openjdk-headless
|
||||
state: present
|
||||
when:
|
||||
- ansible_facts.os_family == 'RedHat'
|
||||
|
||||
- name: Link default logs directory
|
||||
become: yes
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ item }}"
|
||||
dest: /opt/openjdk
|
||||
force: true
|
||||
with_fileglob:
|
||||
- /usr/lib/jvm/java-17-openjdk*
|
||||
when:
|
||||
- ansible_facts.os_family == "Debian"
|
||||
|
||||
- name: Link default logs directory
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: /usr/lib/jvm/jre-17-openjdk
|
||||
dest: /opt/openjdk
|
||||
force: true
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
|
||||
- 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
|
47
molecule/quarkus_devmode/verify.yml
Normal file
47
molecule/quarkus_devmode/verify.yml
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
- 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: Verify we are running on requested JAVA_HOME # noqa blocked_modules command-instead-of-module
|
||||
ansible.builtin.shell: |
|
||||
set -o pipefail
|
||||
ps -ef | grep '/opt/openjdk' | grep -v grep
|
||||
args:
|
||||
executable: /bin/bash
|
||||
changed_when: False
|
||||
|
||||
- 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
Add a link
Reference in a new issue