quarkus scenario skip part if hera is used

main
Romain Pelisse 2022-08-02 20:22:35 +02:00 committed by Pelisse Romain
parent 1b1127ed91
commit ded44b084d
2 changed files with 45 additions and 25 deletions

View File

@ -6,18 +6,30 @@
ansible.builtin.yum: ansible.builtin.yum:
name: sudo name: sudo
state: present 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 delegate_to: localhost
- lineinfile:
dest: /etc/hosts - block:
line: "127.0.0.1 instance" - ansible.builtin.lineinfile:
state: present dest: /etc/hosts
delegate_to: localhost line: "127.0.0.1 instance"
become: yes state: present
- file: delegate_to: localhost
become: yes
when:
- hera_home is defined
- hera_home | length == 0
- ansible.builtin.file:
state: directory state: directory
path: /opt/keycloak/keycloak-18.0.0/conf/ path: /opt/keycloak/keycloak-18.0.0/conf/
- copy:
- ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/opt/keycloak/keycloak-18.0.0/conf/{{ item }}" dest: "/opt/keycloak/keycloak-18.0.0/conf/{{ item }}"
mode: 0444 mode: 0444

View File

@ -9,19 +9,27 @@
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: Fetch openID config
shell: | - set_fact:
curl https://instance:8443/realms/master/.well-known/openid-configuration -k | jq . hera_home: "{{ lookup('env', 'HERA_HOME') }}"
delegate_to: localhost
register: openid_config - block:
- debug: - name: Fetch openID config
msg: " {{ openid_config.stdout | from_json }}" shell: |
delegate_to: localhost curl https://instance:8443/realms/master/.well-known/openid-configuration -k | jq .
- name: Verify endpoint URLs delegate_to: localhost
assert: register: openid_config
that: - debug:
- (openid_config.stdout | from_json)["backchannel_authentication_endpoint"] == 'https://instance:8443/realms/master/protocol/openid-connect/ext/ciba/auth' msg: " {{ openid_config.stdout | from_json }}"
- (openid_config.stdout | from_json)['issuer'] == 'https://instance:8443/realms/master' delegate_to: localhost
- (openid_config.stdout | from_json)['authorization_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/auth' - name: Verify endpoint URLs
- (openid_config.stdout | from_json)['token_endpoint'] == 'https://instance:8443/realms/master/protocol/openid-connect/token' assert:
delegate_to: localhost 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