diff --git a/molecule/quarkus/prepare.yml b/molecule/quarkus/prepare.yml index 7d95f2f..f54dbb8 100644 --- a/molecule/quarkus/prepare.yml +++ b/molecule/quarkus/prepare.yml @@ -6,18 +6,30 @@ ansible.builtin.yum: name: sudo state: present - - command: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes -subj '/CN=instance' + + - name: "Display hera_home if defined." + ansible.builtin.set_fact: + hera_home: "{{ lookup('env', 'HERA_HOME') }}" + + - ansible.builtin.command: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes -subj '/CN=instance' delegate_to: localhost - - lineinfile: - dest: /etc/hosts - line: "127.0.0.1 instance" - state: present - delegate_to: localhost - become: yes - - file: + + - block: + - ansible.builtin.lineinfile: + dest: /etc/hosts + line: "127.0.0.1 instance" + state: present + delegate_to: localhost + become: yes + when: + - hera_home is defined + - hera_home | length == 0 + + - ansible.builtin.file: state: directory path: /opt/keycloak/keycloak-18.0.0/conf/ - - copy: + + - ansible.builtin.copy: src: "{{ item }}" dest: "/opt/keycloak/keycloak-18.0.0/conf/{{ item }}" mode: 0444 diff --git a/molecule/quarkus/verify.yml b/molecule/quarkus/verify.yml index 9b469a4..8d86585 100644 --- a/molecule/quarkus/verify.yml +++ b/molecule/quarkus/verify.yml @@ -9,19 +9,27 @@ that: - ansible_facts.services["keycloak.service"]["state"] == "running" - ansible_facts.services["keycloak.service"]["status"] == "enabled" - - name: Fetch openID config - shell: | - curl https://instance:8443/realms/master/.well-known/openid-configuration -k | jq . - delegate_to: localhost - register: openid_config - - debug: - msg: " {{ openid_config.stdout | from_json }}" - delegate_to: localhost - - name: Verify endpoint URLs - assert: - that: - - (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'https://instance:8443/realms/master/protocol/openid-connect/ext/ciba/auth' - - (openid_config.stdout | from_json)['issuer'] == 'https://instance:8443/realms/master' - - (openid_config.stdout | from_json)['authorization_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/auth' - - (openid_config.stdout | from_json)['token_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/token' - delegate_to: localhost + + - set_fact: + hera_home: "{{ lookup('env', 'HERA_HOME') }}" + + - block: + - name: Fetch openID config + shell: | + curl https://instance:8443/realms/master/.well-known/openid-configuration -k | jq . + delegate_to: localhost + register: openid_config + - debug: + msg: " {{ openid_config.stdout | from_json }}" + delegate_to: localhost + - name: Verify endpoint URLs + assert: + that: + - (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'https://instance:8443/realms/master/protocol/openid-connect/ext/ciba/auth' + - (openid_config.stdout | from_json)['issuer'] == 'https://instance:8443/realms/master' + - (openid_config.stdout | from_json)['authorization_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/auth' + - (openid_config.stdout | from_json)['token_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/token' + delegate_to: localhost + when: + - hera_home is defined + - hera_home | length == 0