From b975363530e283ce24e55d93c2c98adf4c9a3eba Mon Sep 17 00:00:00 2001 From: Dan Arnfield Date: Fri, 15 Nov 2019 14:56:42 -0600 Subject: [PATCH] Don't install docker-ce if docker.io is installed --- roles/matrix-base/tasks/setup_server_base.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/roles/matrix-base/tasks/setup_server_base.yml b/roles/matrix-base/tasks/setup_server_base.yml index 9d3070e2e..7f1749946 100644 --- a/roles/matrix-base/tasks/setup_server_base.yml +++ b/roles/matrix-base/tasks/setup_server_base.yml @@ -38,6 +38,10 @@ update_cache: yes when: ansible_os_family == 'Debian' +- name: Gather package facts (Debian) + package_facts: + when: ansible_os_family == 'Debian' + - name: Ensure Docker's APT key is trusted (Debian) apt_key: url: https://download.docker.com/linux/ubuntu/gpg @@ -45,20 +49,19 @@ state: present register: add_repository_key ignore_errors: true - when: ansible_os_family == 'Debian' + when: ansible_os_family == 'Debian' and 'docker.io' not in ansible_facts.packages - name: Ensure Docker repository is enabled (Debian) apt_repository: repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable" state: present update_cache: yes - when: ansible_os_family == 'Debian' + when: ansible_os_family == 'Debian' and 'docker.io' not in ansible_facts.packages - name: Ensure APT packages are installed (Debian) apt: name: - bash-completion - - docker-ce - python-docker - ntp - fuse @@ -66,6 +69,14 @@ update_cache: yes when: ansible_os_family == 'Debian' +- name: Ensure docker-ce is installed (Debian) + apt: + name: + - docker-ce + state: latest + update_cache: yes + when: "'docker.io' not in ansible_facts.packages" + - name: Ensure Docker is started and autoruns service: name: docker