diff --git a/manifests/run.pp b/manifests/run.pp index d5f339fc..0d189eb9 100755 --- a/manifests/run.pp +++ b/manifests/run.pp @@ -86,6 +86,12 @@ # (optional) Specifies the command to execute after container is created but before it is started. # Default: undef # +# [*remain_after_exit*] +# (optional) If the container is to be managed by a systemd unit file set the +# RemainAfterExit option on the unit file. Can be any valid value for this systemd +# configuration. +# Default: Not included in unit file +# define docker::run( Optional[Pattern[/^[\S]*$/]] $image, Optional[Pattern[/^present$|^absent$/]] $ensure = 'present', @@ -143,6 +149,7 @@ Optional[Boolean] $restart_on_unhealthy = false, Optional[Integer] $health_check_interval = undef, Variant[String,Array,Undef] $custom_unless = [], + Optional[String] $remain_after_exit = undef, ) { include docker::params if ($socket_connect != []) { diff --git a/templates/etc/systemd/system/docker-run.erb b/templates/etc/systemd/system/docker-run.erb index ebd949f4..0f26bfe4 100644 --- a/templates/etc/systemd/system/docker-run.erb +++ b/templates/etc/systemd/system/docker-run.erb @@ -30,6 +30,9 @@ SyslogIdentifier=<%= @_syslog_identifier %> <%- end -%> ExecStart=/usr/local/bin/docker-run-<%= @sanitised_title %>-start.sh ExecStop=-/usr/local/bin/docker-run-<%= @sanitised_title %>-stop.sh +<%- if @remain_after_exit %> +RemainAfterExit=<%= @remain_after_exit %> +<%- end -%> [Install] WantedBy=multi-user.target