Merge pull request #310 from thedanbob/docker.io

Don't install docker-ce if docker.io is installed
This commit is contained in:
Slavi Pantaleev 2019-11-16 09:40:56 +02:00 committed by GitHub
commit a297e617ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,6 +38,10 @@
update_cache: yes update_cache: yes
when: ansible_os_family == 'Debian' 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) - name: Ensure Docker's APT key is trusted (Debian)
apt_key: apt_key:
url: https://download.docker.com/linux/ubuntu/gpg url: https://download.docker.com/linux/ubuntu/gpg
@ -45,20 +49,19 @@
state: present state: present
register: add_repository_key register: add_repository_key
ignore_errors: true 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) - name: Ensure Docker repository is enabled (Debian)
apt_repository: apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable" repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
state: present state: present
update_cache: yes 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) - name: Ensure APT packages are installed (Debian)
apt: apt:
name: name:
- bash-completion - bash-completion
- docker-ce
- python-docker - python-docker
- ntp - ntp
- fuse - fuse
@ -66,6 +69,14 @@
update_cache: yes update_cache: yes
when: ansible_os_family == 'Debian' 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 - name: Ensure Docker is started and autoruns
service: service:
name: docker name: docker