From d7597771cfe777d78b3d68e4915217a0c2fcbfd3 Mon Sep 17 00:00:00 2001 From: Guido Grazioli Date: Fri, 14 Jan 2022 10:14:24 +0100 Subject: [PATCH] Drop service logfile, symlink log directory instead --- roles/keycloak/tasks/main.yml | 12 ++++++++++-- roles/keycloak/templates/keycloak-service.sh.j2 | 3 +-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/keycloak/tasks/main.yml b/roles/keycloak/tasks/main.yml index 66f56b3..bcf0c06 100644 --- a/roles/keycloak/tasks/main.yml +++ b/roles/keycloak/tasks/main.yml @@ -6,9 +6,17 @@ tags: - prereqs -- include_tasks: tasks/install.yml +- name: Include install tasks + include_tasks: tasks/install.yml -- include_tasks: tasks/systemd.yml +- name: Include systemd tasks + include_tasks: tasks/systemd.yml + +- name: Link default logs directory + file: + state: link + src: "{{keycloak_jboss_home}}/standalone/log" + dest: /var/log/keycloak - block: - name: Check admin credentials by generating a token diff --git a/roles/keycloak/templates/keycloak-service.sh.j2 b/roles/keycloak/templates/keycloak-service.sh.j2 index 422ccde..82e3a21 100755 --- a/roles/keycloak/templates/keycloak-service.sh.j2 +++ b/roles/keycloak/templates/keycloak-service.sh.j2 @@ -83,8 +83,7 @@ startKeycloak() { -Djboss.management.https.port=${KEYCLOAK_MANAGEMENT_HTTPS_PORT} \ -Djboss.node.name={{ inventory_hostname }} \ {% if keycloak_prefer_ipv4 %}-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true {% endif %}\ - {% if keycloak_config_standalone_xml is defined %}--server-config={{ keycloak_config_standalone_xml }}{% endif %} \ - 2>&1 >> "${KEYCLOAK_LOGFILE}" & + {% if keycloak_config_standalone_xml is defined %}--server-config={{ keycloak_config_standalone_xml }}{% endif %} & while [ ! -f ${KEYCLOAK_PIDFILE} ]; do sleep 1; done fi }