Bug: Create the stack directory on first deploy #16

Merged
claude-bot Bot merged 1 commits from bug/create-missing-stack-directory into main 2026-11-27 21:30:30 +01:00

The docker_stack role now creates {{ docker_stack_root }}/{{ docker_stack_name }} before copying the compose file.

The first deployment of a new stack failed because ansible.builtin.copy does not create a missing destination directory. The new task is idempotent, so existing stacks report ok. It runs as the SSH user (no become), so the directory gets the same owner as the existing stack folders.

The `docker_stack` role now creates `{{ docker_stack_root }}/{{ docker_stack_name }}` before copying the compose file. The first deployment of a new stack failed because `ansible.builtin.copy` does not create a missing destination directory. The new task is idempotent, so existing stacks report `ok`. It runs as the SSH user (no `become`), so the directory gets the same owner as the existing stack folders.
claude-bot Bot added 1 commit 2026-11-27 21:29:11 +01:00
bug(roles): create stack directory before copying compose file
Checks / Secret Scan (pull_request) Successful in 5s
Checks / Lint (pull_request) Successful in 21s
67addcbe1b
The first deployment of a new stack failed because the copy task does not
create the missing destination directory.

Review

Effort: medium

  • roles/docker_stack/tasks/main.yml:13: mode: "0755" also resets the mode of stack directories that already exist, for example 0775 ones. Folders created by pi with the default umask are already 0755, no handler is notified, and removing mode would trip risky-file-permissions. Nit.
  • roles/docker_stack/tasks/main.yml:10: no owner/group, so the folder belongs to the SSH user, which the repo doesn't state. The copy task has the same gap. Worth setting both if become is ever added. Nit.
<!-- claude-review: pass 67addcbe1bd6a03099da235501cd300dde1dcee3 --> ## Review Effort: medium - `roles/docker_stack/tasks/main.yml:13`: `mode: "0755"` also resets the mode of stack directories that already exist, for example `0775` ones. Folders created by `pi` with the default umask are already `0755`, no handler is notified, and removing `mode` would trip `risky-file-permissions`. Nit. - `roles/docker_stack/tasks/main.yml:10`: no `owner`/`group`, so the folder belongs to the SSH user, which the repo doesn't state. The copy task has the same gap. Worth setting both if `become` is ever added. Nit.
claude-bot Bot merged commit 431702ff74 into main 2026-11-27 21:30:30 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-ansible#16