Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables to override service start retries and delay #51

Merged
merged 2 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tags:
- security
- infrastructure
- authentication
- java
dependencies:
"middleware_automation.redhat_csp_download": ">=1.2.1"
"community.general": ">=5.6.0"
Expand Down
4 changes: 3 additions & 1 deletion roles/keycloak/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### Configuration specific to keycloak
keycloak_version: 18.0.2
keycloak_archive: "keycloak-legacy-{{ keycloak_version }}.zip"
keycloak_download_url: "https://github.com/keycloak/keycloak/releases/download/{{ keycloak_version }}/{{ keycloak_archive }}"
keycloak_download_url: "https://github.com/keycloak/keycloak/releases/download/{{ keycloak_version }}/{{ keycloak_archive }}"
keycloak_download_url_9x: "https://downloads.jboss.org/keycloak/{{ keycloak_version }}/{{ keycloak_archive }}"
keycloak_installdir: "{{ keycloak_dest }}/keycloak-{{ keycloak_version }}"
keycloak_offline_install: False
Expand All @@ -21,6 +21,8 @@ keycloak_service_group: keycloak
keycloak_service_pidfile: "/run/keycloak.pid"
keycloak_service_name: keycloak
keycloak_service_desc: Keycloak
keycloak_service_start_delay: 10
keycloak_service_start_retries: 25

keycloak_configure_firewalld: False

Expand Down
8 changes: 8 additions & 0 deletions roles/keycloak/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ argument_specs:
default: "Keycloak"
description: "systemd description for keycloak"
type: "str"
keycloak_service_start_delay:
default: "10"
description: "Expected delay in ms before the service is expected to be available after start."
rpelisse marked this conversation as resolved.
Show resolved Hide resolved
type: "int"
keycloak_service_start_retries:
default: "25"
description: "How many time should Ansible retry to connect to the service after it was started, before failing."
type: "int"
keycloak_no_log:
default: true
type: "bool"
Expand Down
4 changes: 2 additions & 2 deletions roles/keycloak/tasks/restart_keycloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
until: keycloak_status.status == 200
delegate_to: "{{ ansible_play_hosts | first }}"
run_once: True
retries: 25
delay: 10
retries: "{{ keycloak_service_start_retries }}"
delay: "{{ keycloak_service_start_delay }}"

- name: "Restart and enable {{ keycloak.service_name }} service"
ansible.builtin.systemd:
Expand Down
4 changes: 2 additions & 2 deletions roles/keycloak/tasks/start_keycloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
url: "{{ keycloak.health_url }}"
register: keycloak_status
until: keycloak_status.status == 200
retries: 25
delay: 10
retries: "{{ keycloak_service_start_retries }}"
rpelisse marked this conversation as resolved.
Show resolved Hide resolved
delay: "{{ keycloak_service_start_delay }}"