summaryrefslogtreecommitdiffstats
path: root/tools/cicdansible
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-12-11 13:57:08 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-12-30 10:13:14 +0000
commitfa807fc95ae404f9bdd2f0ed80906ea96bc79a46 (patch)
treef7cdc60d227de5e1ca3607ce35b3b7d9958ad597 /tools/cicdansible
parentb0b87b21a194d473eb85479c62ec6a92827bb767 (diff)
Support setting custom docker registry mirror in cicdansible
This facility allows setting custom docker registry mirror on k8s hosts in Docker global config. Change-Id: I01d02bdbabf2bed0b5b55819ae22770dd52de771 Issue-ID: OOM-2650 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'tools/cicdansible')
-rw-r--r--tools/cicdansible/ansible.cfg1
-rw-r--r--tools/cicdansible/group_vars/all.yml2
-rw-r--r--tools/cicdansible/roles/configure_instances/templates/daemon.json.j218
3 files changed, 20 insertions, 1 deletions
diff --git a/tools/cicdansible/ansible.cfg b/tools/cicdansible/ansible.cfg
index e74dda58..8ffd6ee2 100644
--- a/tools/cicdansible/ansible.cfg
+++ b/tools/cicdansible/ansible.cfg
@@ -4,6 +4,7 @@
stdout_callback=debug
#Default verbosity level, for logging all module outputs.
verbosity=1
+jinja2_extensions = jinja2.ext.do
[inventory]
#Fail when inventory parsing fails.
diff --git a/tools/cicdansible/group_vars/all.yml b/tools/cicdansible/group_vars/all.yml
index 3165e374..e4265b11 100644
--- a/tools/cicdansible/group_vars/all.yml
+++ b/tools/cicdansible/group_vars/all.yml
@@ -42,6 +42,8 @@ router_addr: "10.1.0.1"
external_subnet_cidr: ""
#Address of cicd docker registry.
cicd_docker_registry: ""
+#Address of custom docker registry mirror
+docker_registry_mirror: ""
#Number of nodes to deploy.
num_nodes: "3"
#Stack name to deploy on heat.
diff --git a/tools/cicdansible/roles/configure_instances/templates/daemon.json.j2 b/tools/cicdansible/roles/configure_instances/templates/daemon.json.j2
index 1c3ca9bb..01e5e512 100644
--- a/tools/cicdansible/roles/configure_instances/templates/daemon.json.j2
+++ b/tools/cicdansible/roles/configure_instances/templates/daemon.json.j2
@@ -1,3 +1,19 @@
+{% set insecure_registries = [] %}
+{% for registry in [cicd_docker_registry, docker_registry_mirror] %}
+{% if registry|length > 0 %}
+{% do insecure_registries.append(registry) %}
+{% endif %}
+{% endfor %}
{
-"insecure-registries": ["{{ cicd_docker_registry }}"]
+"insecure-registries": [
+{%- for registry in insecure_registries %}
+"{{ registry }}"{% if not loop.last %}, {% else %}]{% endif %}
+{% endfor %}
+{% if docker_registry_mirror|length > 0 %}
+,
+"registry-mirrors": ["http://{{ docker_registry_mirror }}"]
}
+{% else %}
+
+}
+{% endif %}