45 lines
1013 B
YAML
45 lines
1013 B
YAML
---
|
|
- 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
|
|
repo: deb [arch=arm64] https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
|
|
state: present
|
|
|
|
- name: Install Docker, docker-compose & cron.
|
|
apt:
|
|
name:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-compose
|
|
- 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
|
|
job: docker system prune -af
|