summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@redhat.com>2019-02-20 08:12:00 -0800
committerJames E. Blair <jeblair@redhat.com>2019-02-21 14:07:43 -0800
commit90fc18f62171291e2551ba4d3b4f914b3d38480f (patch)
tree7d2274fdc50119de4b74c577e60a74707afaba71
parent42df4557053e08d3a7cea8d222adb8ccaa83fc55 (diff)
Split docker mirror config into its own role
So that the docker mirror configuration can be used without the install-docker role (e.g., if another process is used to install docker on a target host), split the part of the role which configures mirrors into its own role and include it in the install-docker role. Change-Id: I7cd7f61e2d1281cd2949c1f69a081c7217d0d328
Notes
Notes (review): Code-Review+2: Andreas Jaeger <jaegerandi@gmail.com> Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Workflow+1: James E. Blair <corvus@inaugust.com> Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Workflow+1: Jeremy Stanley <fungi@yuggoth.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 21 Feb 2019 23:43:08 +0000 Reviewed-on: https://review.openstack.org/638195 Project: openstack-infra/zuul-jobs Branch: refs/heads/master
-rw-r--r--roles/install-docker/tasks/main.yaml12
-rw-r--r--roles/use-docker-mirror/README.rst20
-rw-r--r--roles/use-docker-mirror/tasks/main.yaml11
-rw-r--r--roles/use-docker-mirror/tasks/mirror.yaml (renamed from roles/install-docker/tasks/mirror.yaml)0
-rw-r--r--roles/use-docker-mirror/templates/daemon.json.j24
5 files changed, 37 insertions, 10 deletions
diff --git a/roles/install-docker/tasks/main.yaml b/roles/install-docker/tasks/main.yaml
index d0da85b..45b9684 100644
--- a/roles/install-docker/tasks/main.yaml
+++ b/roles/install-docker/tasks/main.yaml
@@ -1,14 +1,6 @@
1- name: Set mirror_fqdn fact
2 when:
3 - mirror_fqdn is not defined
4 - zuul_site_mirror_fqdn is defined
5 set_fact:
6 mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
7
8- name: Set up docker mirrors 1- name: Set up docker mirrors
9 include: mirror.yaml 2 include_role:
10 when: mirror_fqdn is defined 3 name: use-docker-mirror
11 static: no
12 4
13- name: Install docker-ce from upstream 5- name: Install docker-ce from upstream
14 include: upstream.yaml 6 include: upstream.yaml
diff --git a/roles/use-docker-mirror/README.rst b/roles/use-docker-mirror/README.rst
new file mode 100644
index 0000000..aedcb49
--- /dev/null
+++ b/roles/use-docker-mirror/README.rst
@@ -0,0 +1,20 @@
1Configure docker to use mirrors if available.
2
3**Role Variables**
4
5.. zuul:rolevar:: mirror_fqdn
6 :default: {{ zuul_site_mirror_fqdn }}
7
8 The base host for mirror servers.
9
10.. zuul:rolevar:: docker_mirror
11
12 URL to override the generated docker hub mirror url based on
13 :zuul:rolevar:`install-docker.mirror_fqdn`.
14
15.. zuul:rolevar:: docker_insecure_registries
16 :default: undefined
17
18 Declare this with a list of insecure registries to define the
19 registries which are allowed to communicate with HTTP only or
20 HTTPS with no valid certificate.
diff --git a/roles/use-docker-mirror/tasks/main.yaml b/roles/use-docker-mirror/tasks/main.yaml
new file mode 100644
index 0000000..dd65f95
--- /dev/null
+++ b/roles/use-docker-mirror/tasks/main.yaml
@@ -0,0 +1,11 @@
1- name: Set mirror_fqdn fact
2 when:
3 - mirror_fqdn is not defined
4 - zuul_site_mirror_fqdn is defined
5 set_fact:
6 mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
7
8- name: Set up docker mirrors
9 include: mirror.yaml
10 when: mirror_fqdn is defined
11 static: no
diff --git a/roles/install-docker/tasks/mirror.yaml b/roles/use-docker-mirror/tasks/mirror.yaml
index 17a9686..17a9686 100644
--- a/roles/install-docker/tasks/mirror.yaml
+++ b/roles/use-docker-mirror/tasks/mirror.yaml
diff --git a/roles/use-docker-mirror/templates/daemon.json.j2 b/roles/use-docker-mirror/templates/daemon.json.j2
new file mode 100644
index 0000000..2520818
--- /dev/null
+++ b/roles/use-docker-mirror/templates/daemon.json.j2
@@ -0,0 +1,4 @@
1{
2 {% if docker_insecure_registries is defined -%}"insecure-registries": {{ docker_insecure_registries | to_json }},{% endif %}
3 "registry-mirrors": ["{{ docker_mirror }}"]
4}