aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base/docker.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/profile/base/docker.pp')
-rw-r--r--manifests/profile/base/docker.pp32
1 files changed, 32 insertions, 0 deletions
diff --git a/manifests/profile/base/docker.pp b/manifests/profile/base/docker.pp
index 5e18a85..d035f6a 100644
--- a/manifests/profile/base/docker.pp
+++ b/manifests/profile/base/docker.pp
@@ -28,12 +28,17 @@
# Set docker_namespace to INSECURE_REGISTRY, used when a local registry
# is enabled (defaults to false)
#
+# [*registry_mirror*]
+# Configure a registry-mirror in the /etc/docker/daemon.json file.
+# (defaults to false)
+#
# [*step*]
# step defaults to hiera('step')
#
class tripleo::profile::base::docker (
$docker_namespace = undef,
$insecure_registry = false,
+ $registry_mirror = false,
$step = hiera('step'),
) {
if $step >= 1 {
@@ -64,5 +69,32 @@ class tripleo::profile::base::docker (
subscribe => Package['docker'],
notify => Service['docker'],
}
+
+ if $registry_mirror {
+ $mirror_changes = [
+ 'set dict/entry[. = "registry-mirrors"] "registry-mirrors',
+ "set dict/entry[. = \"registry-mirrors\"]/array/string \"${registry_mirror}\""
+ ]
+ } else {
+ $mirror_changes = [ 'rm dict/entry[. = "registry-mirrors"]', ]
+ }
+
+ file { '/etc/docker/daemon.json':
+ ensure => 'present',
+ content => '{}',
+ mode => '0644',
+ replace => false,
+ require => Package['docker']
+ }
+
+ augeas { 'docker-daemon.json':
+ lens => 'Json.lns',
+ incl => '/etc/docker/daemon.json',
+ changes => $mirror_changes,
+ subscribe => Package['docker'],
+ notify => Service['docker'],
+ require => File['/etc/docker/daemon.json'],
+ }
+
}
}