This commit is contained in:
Pim Kunis 2023-04-17 19:28:35 +02:00
commit 3bf4cc5e41
3 changed files with 58 additions and 0 deletions

4
defaults/main.yml Normal file
View file

@ -0,0 +1,4 @@
docker_daemon_config:
default-address-pools:
- base: "10.204.0.0/16"
size: 24

18
meta/main.yml Normal file
View file

@ -0,0 +1,18 @@
galaxy_info:
role_name: docker
author: Pim Kunis
description: Install Docker.
issue_tracker_url: https://git.pim.kunis.nl/pim/ansible-role-docker/issues
license: GPLv3
min_ansible_version: 1.2
platforms:
- name: Debian
versions:
- bullseye
galaxy_tags:
- "docker"

36
tasks/main.yml Normal file
View file

@ -0,0 +1,36 @@
- name: Install prerequisites
apt:
pkg:
- ca-certificates
- curl
- gnupg
- lsb-release
- python3-pip
- name: Add APT key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /etc/apt/keyrings/docker.gpg
- name: Add repository
apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
- name: Install Docker
apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
- name: Install Python modules
pip:
name:
- docker
- docker-compose
- name: Copy daemon.json
copy:
dest: /etc/docker/daemon.json
content: "{{ docker_daemon_config | to_json }}"
- name: Start Docker
systemd:
name: docker
enabled: true
state: started