summaryrefslogtreecommitdiffstats
path: root/manifests/profile/base/docker.pp
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2017-10-24 11:10:07 +0200
committerEmilien Macchi <emilien@redhat.com>2017-11-03 17:29:00 +0000
commit56fb267608cb32d62751026d1c9b5496b65d4e9c (patch)
treefc223bc5c81d20afa5384653ba5fbd38941aeb51 /manifests/profile/base/docker.pp
parent6e27339c4037604d19444e7bf2709e59944d0c48 (diff)
Make docker network configurable
The default docker0 address conflicts with the InternalApiNetCidr value set in environments/network-environment.yaml. We should provide a way to make the docker network configurable. Change-Id: Ie803b33c93b931f7fefb87b6833eb22fd59cd92d Related-Bug: #1726773 (cherry picked from commit 4462260182b5b6a8922193aff3ff603bbb93cf00)
Diffstat (limited to 'manifests/profile/base/docker.pp')
-rw-r--r--manifests/profile/base/docker.pp25
1 files changed, 25 insertions, 0 deletions
diff --git a/manifests/profile/base/docker.pp b/manifests/profile/base/docker.pp
index 73731ad..7b9f7a6 100644
--- a/manifests/profile/base/docker.pp
+++ b/manifests/profile/base/docker.pp
@@ -35,6 +35,12 @@
# https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.2_Release_Notes/technology-preview-file_systems.html
# Defaults to '--log-driver=journald --signature-verification=false --iptables=false'
#
+# [*configure_network*]
+# Boolean. Whether to configure the docker network. Defaults to false.
+#
+# [*network_options*]
+# Network options to configure. Defaults to ''
+#
# [*configure_storage*]
# Boolean. Whether to configure a docker storage backend. Defaults to true.
#
@@ -68,6 +74,8 @@ class tripleo::profile::base::docker (
$insecure_registries = undef,
$registry_mirror = false,
$docker_options = '--log-driver=journald --signature-verification=false --iptables=false',
+ $configure_network = false,
+ $network_options = '',
$configure_storage = true,
$storage_options = '-s overlay2',
$step = Integer(hiera('step')),
@@ -174,5 +182,22 @@ class tripleo::profile::base::docker (
require => Package['docker'],
}
+ if $configure_network {
+ if $network_options == undef {
+ fail('You must provide a $network_options in order to configure network')
+ }
+ $network_changes = [ "set DOCKER_NETWORK_OPTIONS '\" ${network_options}\"'", ]
+ } else {
+ $network_changes = [ 'rm DOCKER_NETWORK_OPTIONS', ]
+ }
+
+ augeas { 'docker-sysconfig-network':
+ lens => 'Shellvars.lns',
+ incl => '/etc/sysconfig/docker-network',
+ changes => $network_changes,
+ notify => Service['docker'],
+ require => Package['docker'],
+ }
+
}
}