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:
parent
42df455705
commit
90fc18f621
@ -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
|
||||||
|
20
roles/use-docker-mirror/README.rst
Normal file
20
roles/use-docker-mirror/README.rst
Normal 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.
|
11
roles/use-docker-mirror/tasks/main.yaml
Normal file
11
roles/use-docker-mirror/tasks/main.yaml
Normal 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
|
4
roles/use-docker-mirror/templates/daemon.json.j2
Normal file
4
roles/use-docker-mirror/templates/daemon.json.j2
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
{% if docker_insecure_registries is defined -%}"insecure-registries": {{ docker_insecure_registries | to_json }},{% endif %}
|
||||||
|
"registry-mirrors": ["{{ docker_mirror }}"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user