From 33d897bcb6568a6762c12b87c1a23f113b3faf14 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 16 Jun 2016 19:12:11 +0300 Subject: [PATCH] Force install of specified docker version, fixes #295 This allows Ubuntu/Debian to downgrade Docker version if a newer version is installed, instead of failing. --- roles/docker/tasks/main.yml | 3 ++- roles/docker/vars/centos-6.yml | 2 +- roles/docker/vars/debian.yml | 3 ++- roles/docker/vars/fedora-20.yml | 2 +- roles/docker/vars/fedora.yml | 2 +- roles/docker/vars/redhat.yml | 2 +- roles/docker/vars/ubuntu-16.04.yml | 3 ++- roles/docker/vars/ubuntu.yml | 3 ++- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 6126418f1..03db20c75 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -48,7 +48,8 @@ - name: ensure docker packages are installed action: "{{ docker_package_info.pkg_mgr }}" args: - pkg: "{{item}}" + pkg: "{{item.name}}" + force: "{{item.force|default(omit)}}" state: present with_items: "{{ docker_package_info.pkgs }}" when: (ansible_os_family != "CoreOS") and (docker_package_info.pkgs|length > 0) diff --git a/roles/docker/vars/centos-6.yml b/roles/docker/vars/centos-6.yml index 10f2aa9be..484063788 100644 --- a/roles/docker/vars/centos-6.yml +++ b/roles/docker/vars/centos-6.yml @@ -5,7 +5,7 @@ docker_kernel_min_version: '2.6.32-431' docker_package_info: pkg_mgr: yum pkgs: - - docker-io + - name: docker-io docker_repo_key_info: pkg_key: '' diff --git a/roles/docker/vars/debian.yml b/roles/docker/vars/debian.yml index 87bd8834c..ce8b52263 100644 --- a/roles/docker/vars/debian.yml +++ b/roles/docker/vars/debian.yml @@ -9,7 +9,8 @@ docker_versioned_pkg: docker_package_info: pkg_mgr: apt pkgs: - - "{{ docker_versioned_pkg[docker_version] }}" + - name: "{{ docker_versioned_pkg[docker_version] }}" + force: yes docker_repo_key_info: pkg_key: apt_key diff --git a/roles/docker/vars/fedora-20.yml b/roles/docker/vars/fedora-20.yml index 520469279..c74cd9f28 100644 --- a/roles/docker/vars/fedora-20.yml +++ b/roles/docker/vars/fedora-20.yml @@ -5,7 +5,7 @@ docker_kernel_min_version: '0' docker_package_info: pkg_mgr: yum pkgs: - - docker-io + - name: docker-io docker_repo_key_info: pkg_key: '' diff --git a/roles/docker/vars/fedora.yml b/roles/docker/vars/fedora.yml index a27492234..d1693fab7 100644 --- a/roles/docker/vars/fedora.yml +++ b/roles/docker/vars/fedora.yml @@ -8,7 +8,7 @@ docker_versioned_pkg: docker_package_info: pkg_mgr: dnf pkgs: - - "{{ docker_versioned_pkg[docker_version] }}" + - name: "{{ docker_versioned_pkg[docker_version] }}" docker_repo_key_info: pkg_key: '' diff --git a/roles/docker/vars/redhat.yml b/roles/docker/vars/redhat.yml index 9814089e0..5dde8dee1 100644 --- a/roles/docker/vars/redhat.yml +++ b/roles/docker/vars/redhat.yml @@ -3,7 +3,7 @@ docker_kernel_min_version: '0' docker_package_info: pkg_mgr: yum pkgs: - - docker-engine + - name: docker-engine docker_repo_key_info: pkg_key: '' diff --git a/roles/docker/vars/ubuntu-16.04.yml b/roles/docker/vars/ubuntu-16.04.yml index c019c7696..e5b84702d 100644 --- a/roles/docker/vars/ubuntu-16.04.yml +++ b/roles/docker/vars/ubuntu-16.04.yml @@ -10,7 +10,8 @@ docker_versioned_pkg: docker_package_info: pkg_mgr: apt pkgs: - - "{{ docker_versioned_pkg[docker_version] }}" + - name: "{{ docker_versioned_pkg[docker_version] }}" + force: yes docker_repo_key_info: pkg_key: apt_key diff --git a/roles/docker/vars/ubuntu.yml b/roles/docker/vars/ubuntu.yml index 0f8ca9d96..18da1b85e 100644 --- a/roles/docker/vars/ubuntu.yml +++ b/roles/docker/vars/ubuntu.yml @@ -10,7 +10,8 @@ docker_versioned_pkg: docker_package_info: pkg_mgr: apt pkgs: - - "{{ docker_versioned_pkg[docker_version] }}" + - name: "{{ docker_versioned_pkg[docker_version] }}" + force: yes docker_repo_key_info: pkg_key: apt_key