From 3ecadf9df1d070134cc9bbbb4e693cf568d077cf Mon Sep 17 00:00:00 2001 From: Romain Pelisse Date: Wed, 27 Sep 2023 19:02:56 +0200 Subject: [PATCH] common: add user/group to sysd only if defined --- roles/amq_streams_common/templates/service_systemd.j2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/amq_streams_common/templates/service_systemd.j2 b/roles/amq_streams_common/templates/service_systemd.j2 index af61c01..d9c7fa4 100644 --- a/roles/amq_streams_common/templates/service_systemd.j2 +++ b/roles/amq_streams_common/templates/service_systemd.j2 @@ -9,8 +9,10 @@ After=syslog.target network.target {% endif %} {% if service_systemd_env_file is defined %}EnvironmentFile=-{{ service_systemd_env_file }} {% endif %} -User={{ service_user }} -Group={{ service_group }} +{% if service_user is defined %}User={{ service_user }} +{% endif %} +{% if service_group is defined %}Group={{ service_group }} +{% endif %} # # ExecStart={{ server_start }} {{ server_config }} {% if server_extra_args is defined %}{{ server_extra_args }}{% endif %}