2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
2018-05-10 09:19:54 +00:00
|
|
|
---
|
2023-10-04 20:05:59 +00:00
|
|
|
- name: Add Docker PGP key
|
2018-05-10 09:19:54 +00:00
|
|
|
apt_key:
|
2019-02-09 13:59:45 +00:00
|
|
|
keyserver: pgp.mit.edu
|
2018-05-10 09:19:54 +00:00
|
|
|
id: 8D81803C0EBFCD88
|
|
|
|
state: present
|
|
|
|
|
2023-10-04 20:05:59 +00:00
|
|
|
- name: Add Docker apt repository
|
2018-05-10 09:19:54 +00:00
|
|
|
apt_repository:
|
2019-02-09 13:59:45 +00:00
|
|
|
repo: deb https://download.docker.com/linux/ubuntu bionic stable
|
2018-05-10 09:19:54 +00:00
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
|
2023-10-04 20:05:59 +00:00
|
|
|
- name: Install Docker
|
2018-05-10 09:19:54 +00:00
|
|
|
apt:
|
2023-10-04 20:05:59 +00:00
|
|
|
name: "{{ pkgs }}"
|
2018-05-10 09:19:54 +00:00
|
|
|
state: present
|
2023-10-04 20:05:59 +00:00
|
|
|
vars:
|
|
|
|
pkgs:
|
|
|
|
- docker-ce
|
|
|
|
- docker-compose-plugin
|
|
|
|
|
|
|
|
- name: Create docker-compose symlink
|
|
|
|
ansible.builtin.file:
|
|
|
|
name: /usr/local/bin/docker-compose
|
|
|
|
src: /usr/libexec/docker/cli-plugins/docker-compose
|
|
|
|
state: link
|
2018-06-23 15:22:44 +00:00
|
|
|
|
2023-07-07 16:15:01 +00:00
|
|
|
- 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
|
|
|
|
|
2023-10-04 20:05:59 +00:00
|
|
|
- name: Create folder structure for bind mounts
|
2019-02-13 09:05:00 +00:00
|
|
|
file:
|
2023-10-04 20:05:59 +00:00
|
|
|
name: "{{ item }}"
|
2019-02-13 09:05:00 +00:00
|
|
|
state: directory
|
2023-10-04 20:05:59 +00:00
|
|
|
loop:
|
|
|
|
- "{{ volume_root_folder }}"
|
|
|
|
- "{{ volume_website_folder }}"
|
2019-02-13 09:05:00 +00:00
|
|
|
|
2023-10-04 20:05:59 +00:00
|
|
|
- name: Set up services
|
2019-01-19 13:56:23 +00:00
|
|
|
import_tasks: services.yml
|
|
|
|
tags:
|
|
|
|
- setup_services
|