From a220d54d4a9851f2d94605f91882f20b923219f5 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 9 May 2017 21:36:53 -0500 Subject: [PATCH] Fixes #5: Switch to new Docker CE and EE repo layout. --- defaults/main.yml | 13 +++++++++---- tasks/setup-Debian.yml | 12 ++++++++++-- tasks/setup-RedHat.yml | 33 +++++++++++++++++++++++++++++---- templates/docker.repo.j2 | 6 ------ 4 files changed, 48 insertions(+), 16 deletions(-) delete mode 100644 templates/docker.repo.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 2283fb9..3504a86 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,13 +1,18 @@ --- -docker_package: "docker-engine" +# Edition can be one of: 'ce' (Community Edition) or 'ee' (Enterprise Edition). +docker_edition: 'ce' +docker_package: "docker-{{ docker_edition }}" # Docker Compose options. docker_install_compose: true docker_compose_version: "1.13.0" docker_compose_path: /usr/local/bin/docker-compose -# Used only for Debian/Ubuntu. Add 'testing' if you don't want stable. -docker_apt_repository: "deb https://apt.dockerproject.org/repo {{ ansible_distribution|lower }}-{{ ansible_distribution_release }} main" +# Used only for Debian/Ubuntu. Switch 'stable' to 'edge' if needed. +docker_apt_release_channel: stable +docker_apt_repository: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" # Used only for RedHat/CentOS. -docker_yum_repo_version: 'main' # 'testing', 'beta', 'nightly' +docker_yum_repo_url: https://download.docker.com/linux/centos/docker-{{ docker_edition }}.repo +docker_yum_repo_enable_edge: 0 +docker_yum_repo_enable_test: 0 diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index d88b8a4..1213773 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,4 +1,12 @@ --- +- name: Ensure old versions of Docker are not installed. + package: + name: '{{ item }}' + state: absent + with_items: + - docker + - docker-engine + - name: Ensure depdencies are installed. apt: name: "{{ item }}" @@ -9,8 +17,8 @@ - name: Add Docker apt key. apt_key: - url: https://apt.dockerproject.org/gpg - id: 58118E89F3A912897C070ADBF76221572C52609D + url: https://download.docker.com/linux/ubuntu/gpg + id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 state: present - name: Add Docker repository. diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 455eb90..306ea46 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,13 +1,38 @@ --- +- name: Ensure old versions of Docker are not installed. + package: + name: '{{ item }}' + state: absent + with_items: + - docker + - docker-common + - container-selinux + - docker-selinux + - docker-engine + - name: Add Docker GPG key. rpm_key: - key: https://yum.dockerproject.org/gpg + key: https://download.docker.com/linux/centos/gpg state: present - name: Add Docker repository. - template: - src: 'docker.repo.j2' - dest: '/etc/yum.repos.d/docker.repo' + get_url: + url: "{{ docker_yum_repo_url }}" + dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo' owner: root group: root mode: 0644 + +- name: Configure Docker Edge repo. + ini_file: + dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo' + section: 'docker-{{ docker_edition }}-edge' + option: enabled + value: '{{ docker_yum_repo_enable_edge }}' + +- name: Configure Docker Test repo. + ini_file: + dest: '/etc/yum.repos.d/docker-{{ docker_edition }}.repo' + section: 'docker-{{ docker_edition }}-test' + option: enabled + value: '{{ docker_yum_repo_enable_test }}' diff --git a/templates/docker.repo.j2 b/templates/docker.repo.j2 deleted file mode 100644 index d30e695..0000000 --- a/templates/docker.repo.j2 +++ /dev/null @@ -1,6 +0,0 @@ -[docker-{{ docker_yum_repo_version }}] -name=Docker Repository -baseurl=https://yum.dockerproject.org/repo/{{ docker_yum_repo_version }}/{{ ansible_distribution|lower }}/{{ ansible_distribution_version.split(".")[0]|int }}/ -enabled=1 -gpgcheck=1 -gpgkey=https://yum.dockerproject.org/gpg