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
This commit is contained in:
James E. Blair 2019-02-20 08:12:00 -08:00
parent 42df455705
commit 90fc18f621
5 changed files with 37 additions and 10 deletions

View File

@ -1,14 +1,6 @@
- name: Set mirror_fqdn fact
when:
- mirror_fqdn is not defined
- zuul_site_mirror_fqdn is defined
set_fact:
mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
- name: Set up docker mirrors - name: Set up docker mirrors
include: mirror.yaml include_role:
when: mirror_fqdn is defined name: use-docker-mirror
static: no
- name: Install docker-ce from upstream - name: Install docker-ce from upstream
include: upstream.yaml include: upstream.yaml

View File

@ -0,0 +1,20 @@
Configure docker to use mirrors if available.
**Role Variables**
.. zuul:rolevar:: mirror_fqdn
:default: {{ zuul_site_mirror_fqdn }}
The base host for mirror servers.
.. zuul:rolevar:: docker_mirror
URL to override the generated docker hub mirror url based on
:zuul:rolevar:`install-docker.mirror_fqdn`.
.. zuul:rolevar:: docker_insecure_registries
:default: undefined
Declare this with a list of insecure registries to define the
registries which are allowed to communicate with HTTP only or
HTTPS with no valid certificate.

View File

@ -0,0 +1,11 @@
- name: Set mirror_fqdn fact
when:
- mirror_fqdn is not defined
- zuul_site_mirror_fqdn is defined
set_fact:
mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
- name: Set up docker mirrors
include: mirror.yaml
when: mirror_fqdn is defined
static: no

View File

@ -0,0 +1,4 @@
{
{% if docker_insecure_registries is defined -%}"insecure-registries": {{ docker_insecure_registries | to_json }},{% endif %}
"registry-mirrors": ["{{ docker_mirror }}"]
}