From 660765d1c6634382a0e6c07e9eebbfde556ef6a7 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 27 Nov 2026 21:08:07 +0100 Subject: [PATCH 1/5] chore: pin community.docker and install it in CI ansible-core ships only ansible.builtin, so ansible-lint cannot resolve community.docker modules without the collection. --- .gitea/workflows/checks.yaml | 3 +++ collections/requirements.yml | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 collections/requirements.yml diff --git a/.gitea/workflows/checks.yaml b/.gitea/workflows/checks.yaml index 7769a3a..f06195a 100644 --- a/.gitea/workflows/checks.yaml +++ b/.gitea/workflows/checks.yaml @@ -48,6 +48,9 @@ jobs: - name: Install Lint Tools run: pip install -r requirements-dev.txt + - name: Install Ansible Collections + run: ansible-galaxy collection install -r collections/requirements.yml + - name: Run yamllint run: yamllint --strict . diff --git a/collections/requirements.yml b/collections/requirements.yml new file mode 100644 index 0000000..dcf12b2 --- /dev/null +++ b/collections/requirements.yml @@ -0,0 +1,4 @@ +--- +collections: + - name: community.docker + version: "5.4.1" -- 2.54.1 From 0289a216bafeac2ffe6e069c6db810d633b0cf79 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 27 Nov 2026 21:08:10 +0100 Subject: [PATCH 2/5] feature(roles): add docker_stack role --- roles/docker_stack/defaults/main.yml | 3 +++ roles/docker_stack/tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 roles/docker_stack/defaults/main.yml create mode 100644 roles/docker_stack/tasks/main.yml diff --git a/roles/docker_stack/defaults/main.yml b/roles/docker_stack/defaults/main.yml new file mode 100644 index 0000000..bc4f325 --- /dev/null +++ b/roles/docker_stack/defaults/main.yml @@ -0,0 +1,3 @@ +--- +docker_stack_root: "{{ homelab_stacks_root }}" +docker_stack_name: "" diff --git a/roles/docker_stack/tasks/main.yml b/roles/docker_stack/tasks/main.yml new file mode 100644 index 0000000..a20e5aa --- /dev/null +++ b/roles/docker_stack/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Require a stack name + ansible.builtin.assert: + that: + - docker_stack_name | length > 0 + fail_msg: "docker_stack_name must be set" + quiet: true + +- name: Copy compose file for {{ docker_stack_name }} + ansible.builtin.copy: + src: "{{ playbook_dir }}/../stacks/{{ docker_stack_name }}/docker-compose.yml" + dest: "{{ docker_stack_root }}/{{ docker_stack_name }}/docker-compose.yml" + mode: "0644" + +- name: Start {{ docker_stack_name }} + community.docker.docker_compose_v2: + project_src: "{{ docker_stack_root }}/{{ docker_stack_name }}" + state: present -- 2.54.1 From 1b05e959e35898b14beb3405d1c2580655ebe186 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 27 Nov 2026 21:08:13 +0100 Subject: [PATCH 3/5] feature(stacks): adopt it-tools stack The image stays on latest with its Watchtower label until there is an image pinning strategy. --- playbooks/docker_stacks.yml | 10 ++++++++++ stacks/it-tools/docker-compose.yml | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 playbooks/docker_stacks.yml create mode 100644 stacks/it-tools/docker-compose.yml diff --git a/playbooks/docker_stacks.yml b/playbooks/docker_stacks.yml new file mode 100644 index 0000000..8cbbc42 --- /dev/null +++ b/playbooks/docker_stacks.yml @@ -0,0 +1,10 @@ +--- +- name: Deploy stacks + hosts: docker_hosts + gather_facts: false + tasks: + - name: Deploy it-tools + ansible.builtin.include_role: + name: docker_stack + vars: + docker_stack_name: it-tools diff --git a/stacks/it-tools/docker-compose.yml b/stacks/it-tools/docker-compose.yml new file mode 100644 index 0000000..9b62e81 --- /dev/null +++ b/stacks/it-tools/docker-compose.yml @@ -0,0 +1,12 @@ +services: + it-tools: + image: corentinth/it-tools:latest + ports: + - 8085:80 + restart: unless-stopped + container_name: it-tools + labels: + - "com.centurylinklabs.watchtower.enable=true" + environment: + - PUID=1000 + - PGID=1000 -- 2.54.1 From a23ba7bee899b6e36487067990a830adffc7365c Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 27 Nov 2026 21:08:17 +0100 Subject: [PATCH 4/5] feature(ci): add manual deploy stacks workflow --- .gitea/workflows/deploy-stacks.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .gitea/workflows/deploy-stacks.yaml diff --git a/.gitea/workflows/deploy-stacks.yaml b/.gitea/workflows/deploy-stacks.yaml new file mode 100644 index 0000000..1be0e46 --- /dev/null +++ b/.gitea/workflows/deploy-stacks.yaml @@ -0,0 +1,18 @@ +name: Deploy Stacks + +on: + workflow_dispatch: + +jobs: + deploy-stacks: + name: Deploy Stacks + runs-on: ansible + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Ansible Collections + run: ansible-galaxy collection install -r collections/requirements.yml + + - name: Run Stacks Playbook + run: ansible-playbook playbooks/docker_stacks.yml --diff -- 2.54.1 From 1b25ff14500bd7329d463fee1fe5f7072fe571b0 Mon Sep 17 00:00:00 2001 From: kasun Date: Fri, 27 Nov 2026 21:08:21 +0100 Subject: [PATCH 5/5] docs: drop the dry run requirement for adopting a stack --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1e27684..e41ad08 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,7 +19,7 @@ Branch → PR (lint, secret scan, later `--check --diff`) → merge to protected - Keep the `/home/pi/docker//` paths, because Compose derives the project name from the folder. - Ansible manages config, never data. No ownership changes under `DOCKER_DATA_ROOT` (mapped UIDs). -- When adopting a stack: pin its image, remove its Watchtower label, and require a no-change dry run first. +- When adopting a stack: pin its image and remove its Watchtower label. - Gitea, its runner and Postgres never auto-deploy. I trigger them from the `ansible` LXC. ## Secrets -- 2.54.1