diff --git a/CHANGELOG.md b/CHANGELOG.md index 302dc33b5..5a4ee82ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ FEATURES: - Add support for installing NGINX Open Source and NGINX Plus on Alpine Linux 3.21. - Add a parameter, `nginx_distribution_package`, to override the default NGINX package name when installing NGINX from your distribution/OS repository. - Add a parameter, `nginx_skip_os_install_config_check`, to turn off the NGINX config check handler when installing NGINX from the respective distribution package manager. This should help avoid potential issues where the default NGINX config that ships with a distribution is broken for some reason. +- Add a parameter, `nginx_service_after`, to start the service after this list of systemd units. BUG FIXES: diff --git a/defaults/main/systemd.yml b/defaults/main/systemd.yml index 94c2670e0..37268f156 100644 --- a/defaults/main/systemd.yml +++ b/defaults/main/systemd.yml @@ -35,6 +35,12 @@ nginx_service_overridefilename: override.conf # Default is to comment this out # nginx_service_restartsec: 5s +# Start the service after these units +# [Unit] +# After= +# Default is to comment this out +# nginx_service_after: [] + # Enable a custom systemd override file # ** This could break the service ** # Setting this to true disables custom values above diff --git a/templates/services/nginx.service.override.conf.j2 b/templates/services/nginx.service.override.conf.j2 index 829ccf8f5..87e155908 100644 --- a/templates/services/nginx.service.override.conf.j2 +++ b/templates/services/nginx.service.override.conf.j2 @@ -16,3 +16,8 @@ Restart={{ nginx_service_restart }} {% if nginx_service_restartsec is defined %} RestartSec={{ nginx_service_restartsec }} {% endif %} + +[Unit] +{% if nginx_service_after %} +After={{ nginx_service_after | join(" ") }} +{% endif %}