commit d3a7042f6141f14ee312a1923534c10c80214a5e Author: Elouin Date: Tue Jan 21 20:32:40 2025 +0100 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..31753f3 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# watchtower formula + +Salt formula for deploying watchtower using docker. diff --git a/pillar.example b/pillar.example new file mode 100644 index 0000000..5552eef --- /dev/null +++ b/pillar.example @@ -0,0 +1,8 @@ +watchtower: + image: + path: ghcr.io/containrrr/watchtower + version: latest + command: "container1 container2" + environment: + VAR: value + VAR2: value diff --git a/watchtower/init.sls b/watchtower/init.sls new file mode 100644 index 0000000..d2fd284 --- /dev/null +++ b/watchtower/init.sls @@ -0,0 +1,17 @@ +watchtower docker conatiner running: + docker_container.running: + - name: watchtower + - image: {{ salt['pillar.get']('watchtower:image:path', 'ghcr.io/containrrr/watchtower') }}:{{ salt['pillar.get']('watchtower:image:version', 'latest') }} + - container_name: watchtower + - command: {{ salt['pillar.get']('watchtower:command', '') }} + {% if pillar['watchtower']['environment'] %} + - environment: + {% for key, value in pillar.get('watchtower:environment', {}).items() %} + - {{key}}={{value}} + {% endfor %} + {% endif %} + - binds: + - /var/run/docker.sock:/var/run/docker.sock:ro + - restart: always + - networks: + - bridge