Merge pull request #3163 from kubernetes-incubator/fix-docker-ubuntu1804

Fix docker apt-repo for Ubuntu18
This commit is contained in:
Antoine Legrand 2018-08-24 00:51:59 +02:00 committed by GitHub
commit 6d74a3db7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 2 deletions

View file

@ -73,7 +73,9 @@
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ dockerproject_repo_key_info.repo_keys }}" with_items: "{{ dockerproject_repo_key_info.repo_keys }}"
when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic) when:
- not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic)
- use_docker_engine is defined and use_docker_engine
- name: ensure docker-engine repository is enabled - name: ensure docker-engine repository is enabled
action: "{{ dockerproject_repo_info.pkg_repo }}" action: "{{ dockerproject_repo_info.pkg_repo }}"
@ -81,7 +83,9 @@
repo: "{{item}}" repo: "{{item}}"
state: present state: present
with_items: "{{ dockerproject_repo_info.repos }}" with_items: "{{ dockerproject_repo_info.repos }}"
when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic) and (dockerproject_repo_info.repos|length > 0) when:
- use_docker_engine is defined and use_docker_engine
- not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS", "RedHat", "Suse"] or is_atomic) and (dockerproject_repo_info.repos|length > 0)
- name: Configure docker repository on RedHat/CentOS - name: Configure docker repository on RedHat/CentOS
template: template:
@ -104,6 +108,7 @@
line: 'obsoletes=0' line: 'obsoletes=0'
when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic
- name: ensure docker packages are installed - name: ensure docker packages are installed
action: "{{ docker_package_info.pkg_mgr }}" action: "{{ docker_package_info.pkg_mgr }}"
args: args:
@ -111,6 +116,7 @@
force: "{{item.force|default(omit)}}" force: "{{item.force|default(omit)}}"
conf_file: "{{item.yum_conf|default(omit)}}" conf_file: "{{item.yum_conf|default(omit)}}"
state: present state: present
update_cache: yes
register: docker_task_result register: docker_task_result
until: docker_task_result|succeeded until: docker_task_result|succeeded
retries: 4 retries: 4
@ -118,6 +124,17 @@
with_items: "{{ docker_package_info.pkgs }}" with_items: "{{ docker_package_info.pkgs }}"
notify: restart docker notify: restart docker
when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] or is_atomic) and (docker_package_info.pkgs|length > 0) when: not (ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] or is_atomic) and (docker_package_info.pkgs|length > 0)
ignore_errors: true
- name: get available packages on Ubuntu
command: apt-cache policy docker-ce
when: docker_task_result|failed
register: available_packages
- name: show available packages on ubuntu
fail:
msg: "{{available_packages}}"
when: docker_task_result|failed
- name: ensure service is started if docker packages are already present - name: ensure service is started if docker packages are already present
service: service:

View file

@ -0,0 +1,32 @@
---
docker_kernel_min_version: '3.10'
use_docker_engine: false
docker_versioned_pkg:
'latest': docker-ce
'17.03': docker-ce=17.03.2~ce-0~ubuntu-xenial
'18.03': docker-ce=18.03.1~ce-3-0~ubuntu
'18.06': docker-ce=18.06.1~ce~3-0~ubuntu
'stable': docker-ce=18.06.1~ce~3-0~ubuntu
'edge': docker-ce=18.06.1~ce~3-0~ubuntu
docker_package_info:
pkg_mgr: apt
pkgs:
- name: "{{ docker_versioned_pkg[docker_version | string] }}"
force: yes
docker_repo_key_info:
pkg_key: apt_key
url: '{{ docker_ubuntu_repo_gpgkey }}'
repo_keys:
- 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
docker_repo_info:
pkg_repo: apt_repository
repos:
- >
deb [arch=amd64] {{ docker_ubuntu_repo_base_url }}
xenial
stable