diff --git a/playbook.yml b/playbook.yml index 8b7f99a3..db999e19 100644 --- a/playbook.yml +++ b/playbook.yml @@ -23,6 +23,7 @@ - docker_registry - drone - websites + - watchtower smtp_host: postfix smtp_port: 587 diff --git a/roles/docker/tasks/services/watchtower.yml b/roles/docker/tasks/services/watchtower.yml new file mode 100644 index 00000000..ffe05afa --- /dev/null +++ b/roles/docker/tasks/services/watchtower.yml @@ -0,0 +1,12 @@ +--- +- name: watchtower container + docker_container: + name: watchtower + image: v2tec/watchtower + restart_policy: unless-stopped + networks: + - name: external_services + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /root/.docker/config.json:/config.json + command: ["--label-enable"] diff --git a/roles/docker/tasks/services/websites.yml b/roles/docker/tasks/services/websites.yml index 58334143..74649cd8 100644 --- a/roles/docker/tasks/services/websites.yml +++ b/roles/docker/tasks/services/websites.yml @@ -11,6 +11,8 @@ VIRTUAL_HOST : "{{ data_coop_website.domain }}" LETSENCRYPT_HOST: "{{ data_coop_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + labels: + com.centurylinklabs.watchtower.enable: "true" - name: setup cryptohagen.dk website docker container docker_container: @@ -23,3 +25,5 @@ VIRTUAL_HOST : "{{ cryptohagen_website.domain }}" LETSENCRYPT_HOST: "{{ cryptohagen_website.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + labels: + com.centurylinklabs.watchtower.enable: "true"