This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/roles/docker/tasks/main.yml
2023-01-06 19:51:28 +01:00

41 lines
999 B
YAML

- name: Install Docker prerequisites
apt:
pkg:
- ca-certificates
- curl
- gnupg
- lsb-release
- python3-pip
- name: Add Docker APT key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
- name: Add Docker repository
apt_repository:
repo: "deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
register: apt_repository
- name: Update APT cache
apt:
update_cache: true
when: apt_repository.changed
- name: Install Docker packages
apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
- name: Install Docker modules for Python
pip:
name:
- docker
- docker-compose
- name: Enable IPv6
copy:
src: "{{ role_path }}/files/daemon.json"
dest: /etc/docker/daemon.json
register: daemon_file
- name: Start Docker
systemd:
name: docker
enabled: true
state: "{{ 'reloaded' if daemon_file.changed else 'started' }}"