diff --git a/playbooks/all.yml b/playbooks/all.yml index 1868667..502f97f 100644 --- a/playbooks/all.yml +++ b/playbooks/all.yml @@ -2,6 +2,7 @@ hosts: homeserver roles: - {role: 'ssh', tags: 'ssh'} + - {role: 'watchtower', tags: 'watchtower'} - {role: 'borg', tags: 'borg'} - {role: 'nsd', tags: 'nsd'} - {role: 'forgejo', tags: 'forgejo'} diff --git a/roles/watchtower/files/docker-compose.yml b/roles/watchtower/files/docker-compose.yml new file mode 100644 index 0000000..3a1cf0f --- /dev/null +++ b/roles/watchtower/files/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3" +services: + watchtower: + image: containrrr/watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --schedule "0 0 4 * * *" # 4 uur UTC = 5 uur NL tijd diff --git a/roles/watchtower/meta/main.yml b/roles/watchtower/meta/main.yml new file mode 100644 index 0000000..7f5b1d3 --- /dev/null +++ b/roles/watchtower/meta/main.yml @@ -0,0 +1,4 @@ +dependencies: + - role: common + - role: docker + \ No newline at end of file diff --git a/roles/watchtower/tasks/main.yml b/roles/watchtower/tasks/main.yml new file mode 100644 index 0000000..2518ba7 --- /dev/null +++ b/roles/watchtower/tasks/main.yml @@ -0,0 +1,14 @@ +- name: Create app directory + file: + path: "{{ service_dir }}" + state: directory +- name: Copy Docker Compose script + copy: + src: "{{ role_path }}/files/docker-compose.yml" + dest: "{{ service_dir }}/docker-compose.yml" +- name: Start the Docker Compose + docker_compose: + project_src: "{{ service_dir }}" + pull: true + remove_orphans: true + diff --git a/roles/watchtower/vars/main.yml b/roles/watchtower/vars/main.yml new file mode 100644 index 0000000..6b39621 --- /dev/null +++ b/roles/watchtower/vars/main.yml @@ -0,0 +1,2 @@ +service_name: watchtower +service_dir: "{{ base_service_dir }}/{{ service_name }}"