From e3b8fb5f59ebb4aa42fff5cff16298d9a1759e59 Mon Sep 17 00:00:00 2001
From: Kevin TIBI <kevin-externe.tibi@enedis.fr>
Date: Thu, 9 Nov 2017 13:16:27 +0000
Subject: [PATCH] add conf for private registry

---
 ansible/container-image-build.yml                    | 3 +++
 ansible/group_vars/all/kolla                         | 3 +++
 ansible/roles/kolla-ansible/templates/globals.yml.j2 | 3 +++
 etc/kayobe/kolla.yml                                 | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/ansible/container-image-build.yml b/ansible/container-image-build.yml
index 742e6e62..dd88951d 100644
--- a/ansible/container-image-build.yml
+++ b/ansible/container-image-build.yml
@@ -34,8 +34,10 @@
       
     - name: Login to docker registry
       docker_login:
+        registry_url: "{{ kolla_docker_registry or omit }}"
         username: "{{ kolla_docker_registry_username }}"
         password: "{{ kolla_docker_registry_password }}"
+        reauthorize: yes
       when: kolla_docker_registry_username is not none and kolla_docker_registry_password is not none
 
     - name: Ensure Kolla container images are built
@@ -45,6 +47,7 @@
         kolla-build \
         --config-dir {{ kolla_build_config_path }} \
         {% if item.type is defined %}--type {{ item.type }}{% endif %} \
+        {% if kolla_docker_registry is defined %}--registry {{ kolla_docker_registry }}{% endif %} \
         {% if push_images | bool %}--push{% endif %} \
         {{ item.regexes }} 2>&1 | tee --append {{ kolla_build_log_path }}
       with_items: "{{ container_image_sets }}"
diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla
index 726cf85b..e1bacfe2 100644
--- a/ansible/group_vars/all/kolla
+++ b/ansible/group_vars/all/kolla
@@ -58,6 +58,9 @@ kolla_install_type: "binary"
 # Docker namespace to use for Kolla images.
 kolla_docker_namespace: "stackhpc"
 
+# Url of docker registry to use for Kolla images.
+kolla_docker_registry:
+
 # Username to use to access a docker registry.
 kolla_docker_registry_username:
 
diff --git a/ansible/roles/kolla-ansible/templates/globals.yml.j2 b/ansible/roles/kolla-ansible/templates/globals.yml.j2
index 669fab25..db110668 100644
--- a/ansible/roles/kolla-ansible/templates/globals.yml.j2
+++ b/ansible/roles/kolla-ansible/templates/globals.yml.j2
@@ -53,6 +53,9 @@ node_custom_config: "{{ kolla_node_custom_config_path }}"
 ### Example: Private repository with authentication
 
 #docker_registry: "172.16.0.10:4000"
+{% if kolla_docker_registry %}
+docker_registry: "{{ kolla_docker_registry }}"
+{% endif %}
 docker_namespace: "{{ kolla_docker_namespace }}"
 {% if kolla_docker_registry_username and kolla_docker_registry_password %}
 docker_registry_username: "{{ kolla_docker_registry_username }}"
diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml
index a196284d..c27a199d 100644
--- a/etc/kayobe/kolla.yml
+++ b/etc/kayobe/kolla.yml
@@ -57,6 +57,9 @@
 # Kolla installation type: binary or source.
 #kolla_install_type:
 
+# URL of docker registry to use for Kolla images.
+#kolla_docker_registry:
+
 # Docker namespace to use for Kolla images.
 #kolla_docker_namespace:
 
-- 
GitLab