Skip to content

Commit 4587441

Browse files
koubasadrianiurca
authored andcommitted
Add prepare_service_only param to ::run resource
1 parent c3a9f56 commit 4587441

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

manifests/run.pp

+9-2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
# configuration.
9090
# Default: Not included in unit file
9191
#
92+
# @param prepare_service_only
93+
# (optional) Prepare the service and enable it as usual but do not run it right away.
94+
# Useful when building VM images using masterless Puppet and then letting the Docker images
95+
# to be downloaded when a new VM is created.
96+
# Default: false
97+
#
9298
# @param image
9399
#
94100
# @param ensure
@@ -237,6 +243,7 @@
237243
Optional[Integer] $health_check_interval = undef,
238244
Optional[Variant[String,Array]] $custom_unless = [],
239245
Optional[String] $remain_after_exit = undef,
246+
Optional[Boolean] $prepare_service_only = false,
240247
) {
241248
include docker::params
242249

@@ -643,7 +650,7 @@
643650
}
644651

645652
service { "${service_prefix}${sanitised_title}":
646-
ensure => $running,
653+
ensure => $running and !$prepare_service_only,
647654
enable => true,
648655
provider => $service_provider_real,
649656
hasstatus => $hasstatus,
@@ -667,7 +674,7 @@
667674
}
668675
}
669676
}
670-
if $service_provider_real == 'systemd' {
677+
if $service_provider_real == 'systemd' and !$prepare_service_only {
671678
exec { "docker-${sanitised_title}-systemd-reload":
672679
path => ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/'],
673680
command => 'systemctl daemon-reload',

0 commit comments

Comments
 (0)