homelab/roles/docker/tasks/main.yml

44 lines
990 B
YAML
Raw Normal View History

2022-11-12 12:21:39 +01:00
---
- name: Ensure older Docker versions aren't installed.
apt:
name:
- docker
- docker-engine
- docker.io
- containerd
- runc
state: absent
- name: Add Docker GPG key.
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker PPA.
apt_repository:
# https://gist.github.com/rbq/886587980894e98b23d0eee2a1d84933
2023-12-30 16:51:31 +01:00
repo: deb [arch=arm64] https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
2022-11-12 12:21:39 +01:00
state: present
- name: Install Docker, docker-compose & cron.
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- cron
state: present
- name: Ensure Docker is running & enabled.
service:
name: docker
state: started
enabled: true
- name: Add Docker prune cronjob.
cron:
name: Prune the Docker system.
hour: 4
minute: 0
2023-12-30 11:25:58 +01:00
job: docker system prune -af