Rename install-docker to ensure-docker for consistency

The old role will be kept and include ensure-docker for backwards compatability.

Change-Id: Icb76a954b04631c405b09eb54343fd852a511b83
This commit is contained in:
vass 2020-04-01 18:44:38 +02:00 committed by Mohammed Naser
parent 55e31dd996
commit c80b593fb6
34 changed files with 248 additions and 241 deletions

View File

@ -5,6 +5,7 @@ Container Roles
.. zuul:autorole:: build-docker-image
.. zuul:autorole:: collect-container-logs
.. zuul:autorole:: deploy-openshift
.. zuul:autorole:: ensure-docker
.. zuul:autorole:: install-docker
.. zuul:autorole:: install-kubernetes
.. zuul:autorole:: install-openshift

View File

@ -105,7 +105,7 @@ pull images from the intermediate registry into the buildset registry.
tasks:
- name: Install docker
include_role:
name: install-docker
name: ensure-docker
- name: Run buildset registry (if not already running)
when: buildset_registry is not defined
include_role:

View File

@ -1,3 +1,3 @@
- hosts: all
roles:
- install-docker
- ensure-docker

View File

@ -24,4 +24,4 @@
- (tox_molecule_packages | length) > 0
roles:
- role: install-docker
- role: ensure-docker

View File

@ -15,7 +15,7 @@ They all accept the same input data, principally a list of
dictionaries representing the images to build. YAML anchors_ can be
used to supply the same data to all three jobs.
Use the :zuul:role:`install-docker` or :zuul:role:`install-podman`
Use the :zuul:role:`ensure-docker` or :zuul:role:`install-podman`
role to install Docker or Podman before using these roles.
**Role Variables**

View File

@ -31,7 +31,7 @@ They all accept the same input data, principally a list of
dictionaries representing the images to build. YAML anchors_ can be
used to supply the same data to all three jobs.
Use the :zuul:role:`install-docker` role to install Docker before
Use the :zuul:role:`ensure-docker` role to install Docker before
using this role.
**Role Variables**

View File

@ -0,0 +1,105 @@
An ansible role to install docker and configure it 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:`ensure-docker.mirror_fqdn`.
.. zuul:rolevar:: use_upstream_docker
:default: True
By default this role adds repositories to install docker from upstream
docker. Set this to False to use the docker that comes with the distro.
.. zuul:rolevar:: docker_use_buildset_registry
:default: False
This role does not enable the usage of the buildset registry by default,
this variable allows enabling the usage of the buildset registry after
installing Docker.
.. zuul:rolevar:: docker_compose_install
:default: False
This role does not install docker-compose by default but you can use
this setting to install docker-compose as well.
.. zuul:rolevar:: docker_update_channel
:default: stable
Which update channel to use for upstream docker. The two choices are
``stable``, which is the default and updates quarterly, and ``edge``
which updates monthly.
.. 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.
.. zuul:rolevar:: docker_gpg_key
:default: string
The raw content of the upstream docker gpg key, as found here
https://download.docker.com/linux/fedora/gpg
.. zuul:rolevar:: docker_distro_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**false**. 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_upstream_distro_required_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**true**. The package set is defined by default using distro specific
variables and contains a list of supporting packages required to be
installed prior to installing docker-ce. If the package set needs to
be changed this option can be overridden as needed.
.. zuul:rolevar:: docker_upstream_distro_remove_packages
:default: list
List of packages to be removed before installing new ones. It is used
for avoiding potential conflicts. For example it can remove `docker`
package before trying to install `docker-ce`. The default value is
distro specific.
.. zuul:rolevar:: docker_upstream_distro_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**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:`ensure-docker.docker_download_fqdn`. When this
option is unset, the role will use distro specific variables which are
loaded at the time of execution.
.. zuul:rolevar:: docker_userland_proxy
:type: bool
Set to false to disable the docker userland proxy. This variable is useful
when docker is causing routing problem, such as when a kubernetes deployment
is unable to reach its own service.

View File

@ -0,0 +1,90 @@
---
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "{{ ansible_distribution | lower }}.yaml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml"
- "{{ ansible_os_family | lower }}.yaml"
tags:
- always
- name: Sanity check for distro selection
fail:
msg: >-
This role is not known to be compatible with this distro and no packages have been provided
for installation. Check the inventory and deployment target settings. Make sure facts are
being gathered prior to executing this role.
when:
- not (docker_distro_vars_loaded | bool)
- (docker_distro_packages | length) < 1
- name: Sanity check for distro install
fail:
msg: >-
The docker distro package list contains no packages and the variable `use_upstream_docker`
has been set to "{{ use_upstream_docker }}". To install docker at least one package will be
required. Please check your settings.
docker_distro_packages = {{ docker_distro_packages }}
when:
- (docker_distro_packages | length) < 1
- not (use_upstream_docker | bool)
- name: Sanity check for upstream install
fail:
msg: >-
The docker upstream package list contains no packages and the variable `use_upstream_docker`
has been set to "{{ use_upstream_docker }}". To install docker at least one package will be
required. Please check your settings.
docker_upstream_distro_packages = {{ docker_upstream_distro_packages }}
when:
- (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
- include_tasks: "docker-{{ (use_upstream_docker | bool) | ternary('upstream', 'distro') }}.yaml"
- name: Install docker-compose
become: true
package:
name: docker-compose
state: present
when: docker_compose_install | bool
- name: Flush handlers before role exit
meta: flush_handlers
- name: Validate ability to talk with docker
command: docker ps
changed_when: false
args:
warn: no
- name: Get version details
command: docker version
register: docker_installed_version
- name: Dump installed docker details
debug:
msg: '{{ docker_installed_version }}'
- name: Use buildset registry
include_role:
name: use-buildset-registry
vars:
buildset_registry_docker_user: root
when:
- docker_use_buildset_registry | bool

View File

@ -1,105 +1 @@
An ansible role to install docker and configure it 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:: use_upstream_docker
:default: True
By default this role adds repositories to install docker from upstream
docker. Set this to False to use the docker that comes with the distro.
.. zuul:rolevar:: docker_use_buildset_registry
:default: False
This role does not enable the usage of the buildset registry by default,
this variable allows enabling the usage of the buildset registry after
installing Docker.
.. zuul:rolevar:: docker_compose_install
:default: False
This role does not install docker-compose by default but you can use
this setting to install docker-compose as well.
.. zuul:rolevar:: docker_update_channel
:default: stable
Which update channel to use for upstream docker. The two choices are
``stable``, which is the default and updates quarterly, and ``edge``
which updates monthly.
.. 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.
.. zuul:rolevar:: docker_gpg_key
:default: string
The raw content of the upstream docker gpg key, as found here
https://download.docker.com/linux/fedora/gpg
.. zuul:rolevar:: docker_distro_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**false**. 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_upstream_distro_required_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**true**. The package set is defined by default using distro specific
variables and contains a list of supporting packages required to be
installed prior to installing docker-ce. If the package set needs to
be changed this option can be overridden as needed.
.. zuul:rolevar:: docker_upstream_distro_remove_packages
:default: list
List of packages to be removed before installing new ones. It is used
for avoiding potential conflicts. For example it can remove `docker`
package before trying to install `docker-ce`. The default value is
distro specific.
.. zuul:rolevar:: docker_upstream_distro_packages
:default: list
List of packages to be installed when `use_upstream_docker` is set to
**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.
.. zuul:rolevar:: docker_userland_proxy
:type: bool
Set to false to disable the docker userland proxy. This variable is useful
when docker is causing routing problem, such as when a kubernetes deployment
is unable to reach its own service.
.. warning:: Deprecated, use ensure-docker instead.

View File

@ -1,90 +1,5 @@
---
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "{{ ansible_distribution | lower }}.yaml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml"
- "{{ ansible_os_family | lower }}.yaml"
tags:
- always
- name: Sanity check for distro selection
fail:
msg: >-
This role is not known to be compatible with this distro and no packages have been provided
for installation. Check the inventory and deployment target settings. Make sure facts are
being gathered prior to executing this role.
when:
- not (docker_distro_vars_loaded | bool)
- (docker_distro_packages | length) < 1
- name: Sanity check for distro install
fail:
msg: >-
The docker distro package list contains no packages and the variable `use_upstream_docker`
has been set to "{{ use_upstream_docker }}". To install docker at least one package will be
required. Please check your settings.
docker_distro_packages = {{ docker_distro_packages }}
when:
- (docker_distro_packages | length) < 1
- not (use_upstream_docker | bool)
- name: Sanity check for upstream install
fail:
msg: >-
The docker upstream package list contains no packages and the variable `use_upstream_docker`
has been set to "{{ use_upstream_docker }}". To install docker at least one package will be
required. Please check your settings.
docker_upstream_distro_packages = {{ docker_upstream_distro_packages }}
when:
- (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
- include_tasks: "docker-{{ (use_upstream_docker | bool) | ternary('upstream', 'distro') }}.yaml"
- name: Install docker-compose
become: true
package:
name: docker-compose
state: present
when: docker_compose_install | bool
- name: Flush handlers before role exit
meta: flush_handlers
- name: Validate ability to talk with docker
command: docker ps
changed_when: false
args:
warn: no
- name: Get version details
command: docker version
register: docker_installed_version
- name: Dump installed docker details
debug:
msg: '{{ docker_installed_version }}'
- name: Use buildset registry
- name: Import ensure-docker
include_role:
name: use-buildset-registry
vars:
buildset_registry_docker_user: root
when:
- docker_use_buildset_registry | bool
name: ensure-docker

View File

@ -10,9 +10,9 @@
mode: 0755
when: not stat_result.stat.exists
- name: Run install-docker role
- name: Run ensure-docker role
include_role:
name: install-docker
name: ensure-docker
- name: Install crio
when: kubernetes_runtime == 'cri-o'

View File

@ -10,7 +10,7 @@ Configure docker to use mirrors if available.
.. zuul:rolevar:: docker_mirror
URL to override the generated docker hub mirror url based on
:zuul:rolevar:`install-docker.mirror_fqdn`.
:zuul:rolevar:`ensure-docker.mirror_fqdn`.
.. zuul:rolevar:: docker_insecure_registries
:default: undefined

View File

@ -0,0 +1,6 @@
- hosts: all
tasks:
- name: Run ensure-docker role
include_role:
name: ensure-docker

View File

@ -1,6 +0,0 @@
- hosts: all
tasks:
- name: Run install-docker role
include_role:
name: install-docker

View File

@ -1,61 +1,61 @@
- job:
name: zuul-jobs-test-install-docker
description: Tests install-docker role
name: zuul-jobs-test-ensure-docker
description: Tests ensure-docker role
abstract: true
files:
- roles/install-docker/.*
- roles/ensure-docker/.*
- test-requirements.txt
run: test-playbooks/install-docker.yaml
run: test-playbooks/ensure-docker.yaml
- job:
name: zuul-jobs-test-install-docker-centos-7
description: Tests install-docker role on centos-7
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-centos-7
description: Tests ensure-docker role on centos-7
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: centos-7
label: centos-7
- job:
name: zuul-jobs-test-install-docker-centos-8
description: Tests install-docker role on centos-8
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-centos-8
description: Tests ensure-docker role on centos-8
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: centos-8
label: centos-8
- job:
name: zuul-jobs-test-install-docker-debian-stretch
description: Tests install-docker role on debian-stretch
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-debian-stretch
description: Tests ensure-docker role on debian-stretch
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: debian-stretch
label: debian-stretch
- job:
name: zuul-jobs-test-install-docker-fedora-30
description: Tests install-docker role on fedora-30
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-fedora-30
description: Tests ensure-docker role on fedora-30
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: fedora-30
label: fedora-30
- job:
name: zuul-jobs-test-install-docker-ubuntu-bionic
description: Tests install-docker role on ubuntu-bionic
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-ubuntu-bionic
description: Tests ensure-docker role on ubuntu-bionic
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: ubuntu-bionic
label: ubuntu-bionic
- job:
name: zuul-jobs-test-install-docker-ubuntu-xenial
description: Tests install-docker role on ubuntu-xenial
parent: zuul-jobs-test-install-docker
name: zuul-jobs-test-ensure-docker-ubuntu-xenial
description: Tests ensure-docker role on ubuntu-xenial
parent: zuul-jobs-test-ensure-docker
nodeset:
nodes:
- name: ubuntu-xenial
@ -72,7 +72,7 @@
files:
- roles/pull-from-intermediate-registry/.*
- roles/push-to-intermediate-registry/.*
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/build-docker-image/.*
- roles/run-buildset-registry/.*
- roles/use-buildset-registry/.*
@ -138,7 +138,7 @@
files:
- roles/pull-from-intermediate-registry/.*
- roles/push-to-intermediate-registry/.*
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-kubernetes/.*
- roles/build-docker-image/.*
- roles/run-buildset-registry/.*
@ -161,7 +161,7 @@
files:
- roles/pull-from-intermediate-registry/.*
- roles/push-to-intermediate-registry/.*
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-kubernetes/.*
- roles/build-docker-image/.*
- roles/run-buildset-registry/.*
@ -185,7 +185,7 @@
files:
- roles/pull-from-intermediate-registry/.*
- roles/push-to-intermediate-registry/.*
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-kubernetes/.*
- roles/build-docker-image/.*
- roles/run-buildset-registry/.*
@ -209,7 +209,7 @@
files:
- roles/pull-from-intermediate-registry/.*
- roles/push-to-intermediate-registry/.*
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-openshift/.*
- roles/build-docker-image/.*
- roles/run-buildset-registry/.*
@ -234,7 +234,7 @@
is not meant to be used directly but rather run on changes to
roles in the zuul-jobs repo.
files:
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-kubernetes/.*
- test-playbooks/install-kubernetes/.*
run: test-playbooks/install-kubernetes/docker.yaml
@ -249,7 +249,7 @@
is not meant to be used directly but rather run on changes to
roles in the zuul-jobs repo.
files:
- roles/install-docker/.*
- roles/ensure-docker/.*
- roles/install-kubernetes/.*
- test-playbooks/install-kubernetes/.*
run: test-playbooks/install-kubernetes/crio.yaml
@ -276,12 +276,12 @@
- project:
check:
jobs: &id001
- zuul-jobs-test-install-docker-centos-7
- zuul-jobs-test-install-docker-centos-8
- zuul-jobs-test-install-docker-debian-stretch
- zuul-jobs-test-install-docker-fedora-30
- zuul-jobs-test-install-docker-ubuntu-bionic
- zuul-jobs-test-install-docker-ubuntu-xenial
- zuul-jobs-test-ensure-docker-centos-7
- zuul-jobs-test-ensure-docker-centos-8
- zuul-jobs-test-ensure-docker-debian-stretch
- zuul-jobs-test-ensure-docker-fedora-30
- zuul-jobs-test-ensure-docker-ubuntu-bionic
- zuul-jobs-test-ensure-docker-ubuntu-xenial
- zuul-jobs-test-registry-docker
- zuul-jobs-test-registry-podman
- zuul-jobs-test-registry-buildset-registry