ansible/roles/docker/tasks/main.yml

48 lines
1,006 B
YAML
Raw Normal View History

# vim: ft=yaml.ansible
2018-05-10 09:19:54 +00:00
---
- name: add docker gpg key
apt_key:
keyserver: pgp.mit.edu
2018-05-10 09:19:54 +00:00
id: 8D81803C0EBFCD88
state: present
- name: add docker apt repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
2018-05-10 09:19:54 +00:00
state: present
update_cache: yes
- name: install docker-ce
apt:
name: docker-ce
state: present
2022-12-22 18:13:29 +00:00
- name: install docker python bindings
pip:
2022-12-22 18:13:29 +00:00
executable: pip3
name: "{{ packages }}"
2022-12-22 18:13:29 +00:00
state: present
vars:
packages:
- docker
- docker-compose
- 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
2019-02-13 09:05:00 +00:00
- name: create folder structure for bind mounts
file:
name: "{{ volume_root_folder }}"
state: directory
- name: setup services
import_tasks: services.yml
tags:
- setup_services