From f2f1e7f9d1ac9e004495202f3679dce63f10ad99 Mon Sep 17 00:00:00 2001 From: neith00 Date: Tue, 12 Jun 2018 15:50:27 +0200 Subject: [PATCH] parametrized iptables options for docker daemon --- inventory/sample/group_vars/k8s-cluster.yml | 3 +++ roles/docker/defaults/main.yml | 3 +++ roles/docker/templates/docker-options.conf.j2 | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/k8s-cluster.yml b/inventory/sample/group_vars/k8s-cluster.yml index babdc732a..d03750215 100644 --- a/inventory/sample/group_vars/k8s-cluster.yml +++ b/inventory/sample/group_vars/k8s-cluster.yml @@ -140,6 +140,9 @@ dns_domain: "{{ cluster_name }}" # Path used to store Docker data docker_daemon_graph: "/var/lib/docker" +## Used to set docker daemon iptables options to true +#docker_iptables_enabled: "true" + ## A string of extra options to pass to the docker daemon. ## This string should be exactly as you wish it to appear. ## An obvious use case is allowing insecure-registry access diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 1013523c9..eac454ce4 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -40,3 +40,6 @@ dockerproject_rh_repo_base_url: 'https://yum.dockerproject.org/repo/main/centos/ dockerproject_rh_repo_gpgkey: 'https://yum.dockerproject.org/gpg' dockerproject_apt_repo_base_url: 'https://apt.dockerproject.org/repo' dockerproject_apt_repo_gpgkey: 'https://apt.dockerproject.org/gpg' + +# Used to set docker daemon iptables options +docker_iptables_enabled: "false" diff --git a/roles/docker/templates/docker-options.conf.j2 b/roles/docker/templates/docker-options.conf.j2 index f1587ec4d..296f5a8a1 100644 --- a/roles/docker/templates/docker-options.conf.j2 +++ b/roles/docker/templates/docker-options.conf.j2 @@ -1,5 +1,5 @@ [Service] -Environment="DOCKER_OPTS={{ docker_options|default('') }} --iptables=false" +Environment="DOCKER_OPTS={{ docker_options|default('') }} --iptables={{ docker_iptables_enabled | default('false') }}" {% if docker_mount_flags is defined and docker_mount_flags != "" %} MountFlags={{ docker_mount_flags }} {% endif %}