aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base/docker.pp
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2017-04-07 16:21:39 -0400
committerDan Prince <dprince@redhat.com>2017-04-08 08:48:01 -0400
commit936aece1de21a5c333b93d711444200c00e2419f (patch)
tree4565bbc674c38a76ebab00f6c0b2bbae67a2da38 /manifests/profile/base/docker.pp
parent2ec381a47504208bc2192e3fbb570c638886c5bc (diff)
Add registry_mirror to base::docker profile
This patch adds a new registry_mirror option to help configure /etc/docker/daemon.json so that we can make use of HTTP docker mirrors within upstream TripleO CI (infra). Change-Id: I4b966e9b9b174ca5a6f57974185e0149ea12f232
Diffstat (limited to 'manifests/profile/base/docker.pp')
-rw-r--r--manifests/profile/base/docker.pp23
1 files changed, 23 insertions, 0 deletions
diff --git a/manifests/profile/base/docker.pp b/manifests/profile/base/docker.pp
index 5e18a85..4797d86 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,23 @@ 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"]', ]
+ }
+
+ augeas { 'docker-daemon.json':
+ lens => 'Json.lns',
+ incl => '/etc/docker/daemon.json',
+ changes => $mirror_changes,
+ subscribe => Package['docker'],
+ notify => Service['docker'],
+ }
+
}
}