Option to change the service name.

This commit is contained in:
Andrea Dell'Amico 2022-09-24 18:12:14 +02:00
parent 44e5ce5187
commit 1cae06aaa3
Signed by untrusted user: adellam
GPG Key ID: 147ABE6CEB9E20FF
6 changed files with 11 additions and 16 deletions

View File

@ -12,6 +12,7 @@ keycloak_conf_directory: '{{ keycloak_runtime_home }}/conf'
keycloak_providers_directory: '{{ keycloak_runtime_home }}/providers'
keycloak_data_directory: '{{ keycloak_runtime_home }}/data'
keycloak_log_directory: '/var/log/keycloak'
keycloak_service_name: keycloak
keycloak_optimize_build_at_startup: true
keycloak_upgrade_db_at_startup: false
keycloak_disabled_features: []
@ -54,9 +55,6 @@ keycloak_database_name: keycloak
keycloak_database_user: keycloak_u
# keycloak_database_password: 'define it into a vault file'
keycloak_database_host: 'localhost'
keycloak_database_max_pool_size: '50'
keycloak_database_jboss_connection_checker: true
keycloak_database_idle_timeouts_min: 1
keycloak_admin_user: kadmin
# keycloak_admin_password: 'define it into a vault file'

View File

@ -1,3 +1,5 @@
---
- name: Restart Keycloak
service: name=keycloak state=restarted
ansible.builtin.service:
name: '{{ keycloak_service_name }}'
state: restarted

View File

@ -9,7 +9,7 @@
- name: Install the keycloak systemd unit
ansible.builtin.template:
src: keycloak.service.j2
dest: /etc/systemd/system/keycloak.service
dest: '/etc/systemd/system/{{ keycloak_service_name }}.service'
owner: root
group: root
mode: 0644
@ -21,9 +21,9 @@
daemon_reload: yes
when: keycloak_unit is changed
- name: ensure that the keycloak service is running and enabled
- name: ensure that the {{ keycloak_service_name }} service is running and enabled
ansible.builtin.service:
name: keycloak
name: '{{ keycloak_service_name }}'
state: started
enabled: true

View File

@ -30,9 +30,9 @@ chmod 440 ${KEYCLOAK_KEYFILE} ${KEYCLOAK_CERTFILE}
chown root ${KEYCLOAK_KEYFILE} ${KEYCLOAK_CERTFILE}
chgrp keycloak ${KEYCLOAK_KEYFILE} ${KEYCLOAK_CERTFILE}
logger "acme-keycloak-hook: Restart the keycloak service after a certificate renewal"
systemctl restart keycloak >> $LE_LOGFILE 2>&1
echo "acme-keycloak-hook: Restart the keycloak service" >> $LE_LOGFILE
logger "acme-keycloak-hook: Restart the {{ keycloak_service_name }} service after a certificate renewal"
systemctl restart {{ keycloak_service_name }} >> $LE_LOGFILE 2>&1
echo "acme-keycloak-hook: Restart the {{ keycloak_service_name }} service" >> $LE_LOGFILE
logger "acme-keycloak-hook: Done"
echo "acme-keycloak-hook: Done." >> $LE_LOGFILE

View File

@ -1,5 +1,5 @@
[Unit]
Description=Keycloak Application Server
Description=Keycloak Application Server, running with Quarkus
After=syslog.target network.target
{% if keycloak_before_nginx %}
Before=nginx.service

View File

@ -4,14 +4,9 @@ openjdk_pkgs:
- jre
- jdk
nginx_webroot: '/opt/keycloak/keycloak-{{ keycloak_version }}/welcome-content'
keycloak_user: 'keycloak'
keycloak_version: '{{ keycloak_major_version }}.{{ keycloak_minor_version }}.{{ keycloak_point_version }}'
keycloak_distribution: 'keycloak-{{ keycloak_version }}'
keycloak_distribution_archive: '{{ keycloak_distribution }}.tar.gz'
keycloak_download_url: 'https://github.com/keycloak/keycloak/releases/download/{{ keycloak_version }}/{{ keycloak_distribution_archive }}'
keycloak_runtime_home: '{{ keycloak_install_dir }}/{{ keycloak_distribution }}'
jboss_home: '{{ keycloak_runtime_home }}'
keycloak_owned_directories:
- '{{ keycloak_data_directory }}'
- '{{ keycloak_external_avatar_dir }}'