Fix docker apt-repo for Ubuntu18
This commit is contained in:
parent
32049efbc2
commit
2c90208486
2 changed files with 50 additions and 2 deletions
|
@ -73,7 +73,9 @@
|
|||
retries: 4
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
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
|
||||
action: "{{ dockerproject_repo_info.pkg_repo }}"
|
||||
|
@ -81,7 +83,9 @@
|
|||
repo: "{{item}}"
|
||||
state: present
|
||||
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
|
||||
template:
|
||||
|
@ -104,6 +108,7 @@
|
|||
line: 'obsoletes=0'
|
||||
when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic
|
||||
|
||||
|
||||
- name: ensure docker packages are installed
|
||||
action: "{{ docker_package_info.pkg_mgr }}"
|
||||
args:
|
||||
|
@ -111,6 +116,7 @@
|
|||
force: "{{item.force|default(omit)}}"
|
||||
conf_file: "{{item.yum_conf|default(omit)}}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
register: docker_task_result
|
||||
until: docker_task_result|succeeded
|
||||
retries: 4
|
||||
|
@ -118,6 +124,17 @@
|
|||
with_items: "{{ docker_package_info.pkgs }}"
|
||||
notify: restart docker
|
||||
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
|
||||
service:
|
||||
|
|
31
roles/docker/vars/ubuntu-bionic.yml
Normal file
31
roles/docker/vars/ubuntu-bionic.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
docker_kernel_min_version: '3.10'
|
||||
docker_version: 18.06
|
||||
use_docker_engine: false
|
||||
|
||||
docker_versioned_pkg:
|
||||
'latest': docker-ce
|
||||
'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 {{ docker_ubuntu_repo_base_url }}
|
||||
{{ ansible_distribution_release|lower }}
|
||||
stable
|
Loading…
Reference in a new issue