ansible/roles/docker/tasks/main.yml

38 lines
832 B
YAML

# vim: ft=yaml.ansible
---
- name: add docker gpg key
apt_key:
keyserver: pgp.mit.edu
id: 8D81803C0EBFCD88
state: present
- name: add docker apt repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
update_cache: yes
- name: install docker-ce
apt:
name: docker-ce
state: present
- name: Configure cron job to prune unused Docker data weekly
cron:
name: Prune unused Docker data
cron_file: ansible_docker_prune
job: 'docker system prune -fa && docker volume prune -fa'
special_time: weekly
user: root
state: present
- name: create folder structure for bind mounts
file:
name: "{{ volume_root_folder }}"
state: directory
- name: setup services
import_tasks: services.yml
tags:
- setup_services