1
0
Fork 0

Add watchtower service

This commit is contained in:
Florian RICHER 2023-09-23 11:00:21 +02:00
parent 57ce1d2b44
commit fe2478a373
4 changed files with 36 additions and 0 deletions

View file

@ -16,4 +16,5 @@
- { role: matrix, tags: ["matrix"] }
- { role: iptables, tags: ["iptables"] }
- { role: borg, tags: ["borg"] }
- { role: watchtower, tags: ["watchtower"] }
- { role: clean, tags: ["clean"] }

View file

@ -0,0 +1,22 @@
---
- name: Check watchtower directory exist
ansible.builtin.file:
path: watchtower
state: directory
- name: Copy template conf
ansible.builtin.template:
src: "{{ item.src }}"
dest: "watchtower/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: watchtower_copy_templates_results
- name: Force update and restart container
community.docker.docker_compose:
project_src: watchtower
state: present
pull: true
restarted: "{{ watchtower_copy_templates_results.changed }}"
become: true

View file

@ -0,0 +1,4 @@
---
- ansible.builtin.import_tasks: base.yml
name: base

View file

@ -0,0 +1,9 @@
version: '3'
services:
watchtower:
image: containrrr/watchtower:latest
restart: always
container_name: watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock