Add variable to set the docker download url
The docker mirror URL can now be set using the following options, `docker_download_fqdn` and `docker_mirror_base_url`. These variables will allow folks to use this role with custom mirrors. To accomodate this change, the repo files have been moved into templates and now use the jinja2 extension. Not all supported distros have the ability to install docker using the upstream mirrors. To ensure a high degree of success a new sanity check has been added to validate the mirror url content when upstream installation has been enabled. Change-Id: Ib9d50581d0df89e36d47dd523efd1adc95fdf4ac Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
f1f609e09c
commit
ab2d368b17
@ -62,3 +62,16 @@ An ansible role to install docker and configure it to use mirrors if available.
|
||||
**true**. The package set is defined by default using distro specific
|
||||
variables. If the package set needs to be changed this option can be
|
||||
overridden as needed.
|
||||
|
||||
.. zuul:rolevar:: docker_download_fqdn
|
||||
:default: download.docker.com
|
||||
|
||||
Add default option to set the docker download fqdn.
|
||||
|
||||
.. zuul:rolevar:: docker_mirror_base_url
|
||||
:default: https://{{ docker_download_fqdn }}/linux/{ubuntu,centos,fedora}
|
||||
|
||||
By default this option sets the repository base url. This variable is
|
||||
based on :zuul:rolevar:`install-docker.docker_download_fqdn`. When this
|
||||
option is unset, the role will use distro specific variables which are
|
||||
loaded at the time of execution.
|
||||
|
@ -7,6 +7,8 @@ docker_distro_packages: "{{ _docker_distro_packages | default([]) }}"
|
||||
docker_upstream_distro_packages: "{{ _docker_upstream_distro_packages | default([]) }}"
|
||||
docker_upstream_distro_required_packages: "{{ _docker_upstream_distro_required_packages | default([]) }}"
|
||||
docker_update_channel: stable
|
||||
docker_download_fqdn: download.docker.com
|
||||
docker_mirror_base_url: "{{ _docker_mirror_base_url | default('') }}"
|
||||
docker_gpg_key: |
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
|
@ -1,83 +0,0 @@
|
||||
[docker-ce-stable]
|
||||
name=Docker CE Stable - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-stable-debuginfo]
|
||||
name=Docker CE Stable - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-stable-source]
|
||||
name=Docker CE Stable - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge]
|
||||
name=Docker CE Edge - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge-debuginfo]
|
||||
name=Docker CE Edge - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-edge-source]
|
||||
name=Docker CE Edge - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test]
|
||||
name=Docker CE Test - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test-debuginfo]
|
||||
name=Docker CE Test - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-test-source]
|
||||
name=Docker CE Test - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly]
|
||||
name=Docker CE Nightly - $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly-debuginfo]
|
||||
name=Docker CE Nightly - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
||||
|
||||
[docker-ce-nightly-source]
|
||||
name=Docker CE Nightly - Sources
|
||||
baseurl=https://download.docker.com/linux/centos/7/source/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/centos/gpg
|
@ -1,83 +0,0 @@
|
||||
[docker-ce-stable]
|
||||
name=Docker CE Stable - $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/stable
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-stable-debuginfo]
|
||||
name=Docker CE Stable - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-stable-source]
|
||||
name=Docker CE Stable - Sources
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-edge]
|
||||
name=Docker CE Edge - $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-edge-debuginfo]
|
||||
name=Docker CE Edge - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-edge-source]
|
||||
name=Docker CE Edge - Sources
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/source/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-test]
|
||||
name=Docker CE Test - $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-test-debuginfo]
|
||||
name=Docker CE Test - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-test-source]
|
||||
name=Docker CE Test - Sources
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/source/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-nightly]
|
||||
name=Docker CE Nightly - $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-nightly-debuginfo]
|
||||
name=Docker CE Nightly - Debuginfo $basearch
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/debug-$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
||||
|
||||
[docker-ce-nightly-source]
|
||||
name=Docker CE Nightly - Sources
|
||||
baseurl=https://download.docker.com/linux/fedora/$releasever/source/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey=https://download.docker.com/linux/fedora/gpg
|
@ -44,6 +44,15 @@
|
||||
- (docker_upstream_distro_packages | length) < 1
|
||||
- use_upstream_docker | bool
|
||||
|
||||
- name: Sanity check for upstream install mirrors
|
||||
fail:
|
||||
msg: >-
|
||||
The variable `docker_mirror_base_url` is null, and upstream installation has been enabled.
|
||||
Check your settings.
|
||||
when:
|
||||
- (docker_mirror_base_url | length) < 1
|
||||
- use_upstream_docker | bool
|
||||
|
||||
- name: Upstream block
|
||||
when:
|
||||
- use_upstream_docker | bool
|
||||
|
83
roles/install-docker/templates/docker-ce-centos.repo.j2
Normal file
83
roles/install-docker/templates/docker-ce-centos.repo.j2
Normal file
@ -0,0 +1,83 @@
|
||||
[docker-ce-stable]
|
||||
name=Docker CE Stable - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/$basearch/stable
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-stable-debuginfo]
|
||||
name=Docker CE Stable - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/debug-$basearch/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-stable-source]
|
||||
name=Docker CE Stable - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/7/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge]
|
||||
name=Docker CE Edge - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge-debuginfo]
|
||||
name=Docker CE Edge - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/debug-$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge-source]
|
||||
name=Docker CE Edge - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/7/source/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test]
|
||||
name=Docker CE Test - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test-debuginfo]
|
||||
name=Docker CE Test - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/debug-$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test-source]
|
||||
name=Docker CE Test - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/7/source/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly]
|
||||
name=Docker CE Nightly - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly-debuginfo]
|
||||
name=Docker CE Nightly - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/7/debug-$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly-source]
|
||||
name=Docker CE Nightly - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/7/source/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
83
roles/install-docker/templates/docker-ce-fedora.repo.j2
Normal file
83
roles/install-docker/templates/docker-ce-fedora.repo.j2
Normal file
@ -0,0 +1,83 @@
|
||||
[docker-ce-stable]
|
||||
name=Docker CE Stable - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/$basearch/stable
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-stable-debuginfo]
|
||||
name=Docker CE Stable - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/debug-$basearch/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-stable-source]
|
||||
name=Docker CE Stable - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/source/stable
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge]
|
||||
name=Docker CE Edge - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge-debuginfo]
|
||||
name=Docker CE Edge - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/debug-$basearch/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-edge-source]
|
||||
name=Docker CE Edge - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/source/edge
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test]
|
||||
name=Docker CE Test - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test-debuginfo]
|
||||
name=Docker CE Test - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/debug-$basearch/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-test-source]
|
||||
name=Docker CE Test - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/source/test
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly]
|
||||
name=Docker CE Nightly - $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly-debuginfo]
|
||||
name=Docker CE Nightly - Debuginfo $basearch
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/debug-$basearch/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
||||
|
||||
[docker-ce-nightly-source]
|
||||
name=Docker CE Nightly - Sources
|
||||
baseurl={{ docker_mirror_base_url }}/$releasever/source/nightly
|
||||
enabled=0
|
||||
gpgcheck=1
|
||||
gpgkey={{ docker_mirror_base_url }}/gpg
|
@ -1 +1 @@
|
||||
deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} {{ docker_update_channel }}
|
||||
deb [arch=amd64] {{ docker_mirror_base_url }} {{ ansible_lsb.codename }} {{ docker_update_channel }}
|
||||
|
@ -15,3 +15,5 @@ _docker_upstream_distro_packages:
|
||||
- containerd.io
|
||||
|
||||
docker_distro_vars_loaded: true
|
||||
|
||||
_docker_mirror_base_url: "https://{{ docker_download_fqdn }}/linux/ubuntu"
|
||||
|
@ -14,3 +14,5 @@ _docker_upstream_distro_packages:
|
||||
docker_repo_template: docker-ce-centos.repo
|
||||
|
||||
docker_distro_vars_loaded: true
|
||||
|
||||
_docker_mirror_base_url: "https://{{ docker_download_fqdn }}/linux/fedora"
|
||||
|
@ -16,3 +16,5 @@ _docker_upstream_distro_packages:
|
||||
docker_repo_template: docker-ce-centos.repo
|
||||
|
||||
docker_distro_vars_loaded: true
|
||||
|
||||
_docker_mirror_base_url: "https://{{ docker_download_fqdn }}/linux/centos"
|
||||
|
Loading…
Reference in New Issue
Block a user