From d3a7042f6141f14ee312a1923534c10c80214a5e Mon Sep 17 00:00:00 2001 From: Elouin Date: Tue, 21 Jan 2025 20:32:40 +0100 Subject: [PATCH] init --- README.md | 3 +++ pillar.example | 8 ++++++++ watchtower/init.sls | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 README.md create mode 100644 pillar.example create mode 100644 watchtower/init.sls 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