zuul-jobs/roles/ensure-docker/tasks/docker-upstream.yaml
Mohammed Naser 00cc4aa038 ensure-docker: refactor to use ensure-package-repositories
This patch refactors ensure-docker to use the new ensure-package-repostories
role which cleans up the codebase for it a lot.  It also converges the
Debian and Ubuntu configuration as they were pretty much the same.

Also, it updates the Docker to the proper GPG key as while refactoring,
it was exposed that it was using the wrong key.  Docker uses a different
key for Debian and RHEL based packaging.

Change-Id: Iad430c6a31be0750c1a0f50e12a26df230de9f4e
2020-05-01 15:49:30 +02:00

52 lines
1.5 KiB
YAML

---
- name: Not Implemented
fail:
msg: This set of tasks has not been implemented.
when: ansible_pkg_mgr == 'zypper'
- name: Upstream block
become: true
block:
- name: Set up docker mirrors
include_role:
name: use-docker-mirror
- name: Add all repositories
include_role:
name: ensure-package-repositories
vars:
repositories_keys: "{{ _docker_keys }}"
repositories_list: "{{ _docker_repos }}"
- name: Install pre-reqs
package:
name: "{{ _docker_upstream_distro_required_packages }}"
state: present
- name: Remove packages
package:
name: "{{ docker_upstream_distro_remove_packages }}"
state: absent
when: docker_upstream_distro_remove_packages
# package/dnf module do not support `--nobest` option which is needed for
# installing docker-ce on centos-8
- name: Install upstream docker using package
when: not (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8')
package:
name: "{{ docker_upstream_distro_packages }}"
state: present
notify: Restart docker
- name: Install upstream docker using shell
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8'
shell:
cmd: |
dnf install --nobest -y {{ docker_upstream_distro_packages | join(' ') }}
warn: false
register: result
changed_when: "'Complete!' in result.stdout"
notify: Restart docker
- include_tasks: docker-setup.yaml