54 lines
1.1 KiB
YAML
54 lines
1.1 KiB
YAML
---
|
|
- name: Ensure older Docker versions aren't installed.
|
|
apt:
|
|
name:
|
|
- docker
|
|
- docker-engine
|
|
- docker.io
|
|
- containerd
|
|
- runc
|
|
state: absent
|
|
|
|
- name: Install Docker PPA dependencies.
|
|
apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- gnupg
|
|
- lsb-release
|
|
state: present
|
|
|
|
- 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=amd64] 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 -f
|