Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# docker

Install [docker](https://docker.io) on a debian system

| Variable | Default | Description |
| ------------------------ | ------- | ----------- |
| `docker_install_compose` | `False` | If set to true, docker-compose will be installed |
| `docker_users` | `[]` | List of users that shall be added to the docker-group |


# docker-compose workaround

Optionally installs docker-compose when docker_install_compose is set to True.
This will also install `gnupg2` and `pass`; this is necessary because otherwise it
will break `docker login` as the dependency `golang-docker-credential-helpers`
is broken. Installing `gnupg2` and `pass` makes `docker login` use these instead
of the broken package. Refer to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910823 .
3 changes: 1 addition & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
docker_apt_repo: deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable
docker_install_compose: False

docker_users: []
62 changes: 0 additions & 62 deletions files/docker.gpg

This file was deleted.

42 changes: 11 additions & 31 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
---
- name: Add Docker repository key
become: True
apt_key:
data: "{{ lookup('file', 'files/docker.gpg') }}"
state: present

- name: Remove old docker repo
become: True
apt_repository:
repo: "deb https://apt.dockerproject.org/repo debian-{{ ansible_distribution_release }} main"
mode: "0644"
state: absent

- name: Remove old docker repository key
become: True
apt_key:
id: "58118E89F3A912897C070ADBF76221572C52609D"
keyserver: "hkp://p80.pool.sks-keyservers.net:80"
state: absent

- name: Add docker APT repo
become: True
apt_repository:
repo: "{{ docker_apt_repo }}"
mode: "0644"
state: present

- name: Add docker group
become: True
group:
name: docker
state: present

- name: Add docker_users to the docker group
become: True
user:
name: "{{ item }}"
groups: docker
append: yes
loop: "{{ docker_users }}"

- name: Install docker packages
become: True
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker.io
state: present
update_cache: yes
cache_valid_time: 1800
Expand All @@ -48,7 +27,8 @@
apt:
name:
- docker-compose
- gnupg2
- pass
state: present
update_cache: yes
cache_valid_time: 1800