The docker_stack role renders a stack's .env from OpenBao when stacks/<stack>/env.j2 exists. It reads docker/<stack> from the KV engine with an AppRole login, writes .env with mode 600, and uses no_log and diff: false so values never reach the job log. Stacks without an env.j2 behave as before.
community.hashi_vault 7.1.0 is added to the collection requirements.
inventory/group_vars/all.yml reads the OpenBao address and AppRole credentials from files on the ansible LXC, so no hostname or credential is committed.
The README gets a Secrets section on setting up and using OpenBao.
Gitea is adopted: its compose file is in the repo without the Watchtower label, stacks/gitea/env.j2 lists its variables, and playbooks/gitea.yml deploys it.
Why
Secrets have to stay out of this repo, which is meant to become public. Gitea gets its own playbook because it runs the deploy pipeline: no workflow calls playbooks/gitea.yml, so it is only run by hand from the ansible LXC.
Deploy effect
Merging triggers Deploy Stacks, which runs docker_stacks.yml (it-tools only). it-tools has no env.j2, so it does not contact OpenBao. Gitea is not deployed by the merge.
## What changes
- The `docker_stack` role renders a stack's `.env` from OpenBao when `stacks/<stack>/env.j2` exists. It reads `docker/<stack>` from the KV engine with an AppRole login, writes `.env` with mode `600`, and uses `no_log` and `diff: false` so values never reach the job log. Stacks without an `env.j2` behave as before.
- `community.hashi_vault` 7.1.0 is added to the collection requirements.
- `inventory/group_vars/all.yml` reads the OpenBao address and AppRole credentials from files on the ansible LXC, so no hostname or credential is committed.
- The README gets a Secrets section on setting up and using OpenBao.
- Gitea is adopted: its compose file is in the repo without the Watchtower label, `stacks/gitea/env.j2` lists its variables, and `playbooks/gitea.yml` deploys it.
## Why
Secrets have to stay out of this repo, which is meant to become public. Gitea gets its own playbook because it runs the deploy pipeline: no workflow calls `playbooks/gitea.yml`, so it is only run by hand from the ansible LXC.
## Deploy effect
Merging triggers Deploy Stacks, which runs `docker_stacks.yml` (it-tools only). it-tools has no `env.j2`, so it does not contact OpenBao. Gitea is not deployed by the merge.
Stacks with an env.j2 get their .env from OpenBao, so secrets stay out of the
repo. The address and AppRole credentials are read from files on the ansible
LXC, which keeps hostnames out of the public repo.
stacks/gitea/env.j2:7: values are written to .env unquoted and unescaped, and the README tells you to strip quotes on import. A secret containing $, #, quotes or a newline is changed by Compose: $word is interpolated and #... is dropped as a comment. That would give Gitea the wrong DB password. (important)
README.md:41: the secret files are readable only by the runner user, but playbooks/gitea.yml is run by hand. The README doesn't say to run it as the runner user, so a manual run fails with permission denied on the lookup. (nit)
stacks/gitea/docker-compose.yml:7: USER_GID=${NON_ROOT_USER_UID} uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)
roles/docker_stack/tasks/main.yml:41: no_log also hides which key is missing when the template fails to render. (nit)
roles/docker_stack/tasks/main.yml:34: deleting a stack's env.j2 leaves its old .env on the host. (nit)
README.md:63: the jq import keeps \r from CRLF files and inline comments, and skips export lines. (nit)
<!-- claude-review: fail 6e2dd06b9e4716013590a18c7210236f862d0c81 -->
## Review
Effort: medium
- `stacks/gitea/env.j2:7`: values are written to `.env` unquoted and unescaped, and the README tells you to strip quotes on import. A secret containing `$`, ` #`, quotes or a newline is changed by Compose: `$word` is interpolated and ` #...` is dropped as a comment. That would give Gitea the wrong DB password. (important)
- `README.md:41`: the secret files are readable only by the runner user, but `playbooks/gitea.yml` is run by hand. The README doesn't say to run it as the runner user, so a manual run fails with permission denied on the lookup. (nit)
- `stacks/gitea/docker-compose.yml:7`: `USER_GID=${NON_ROOT_USER_UID}` uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)
- `roles/docker_stack/tasks/main.yml:41`: `no_log` also hides which key is missing when the template fails to render. (nit)
- `roles/docker_stack/tasks/main.yml:34`: deleting a stack's `env.j2` leaves its old `.env` on the host. (nit)
- `README.md:63`: the jq import keeps `\r` from CRLF files and inline comments, and skips `export` lines. (nit)
The earlier quoting finding is resolved: values are rendered unquoted on purpose, matching the live .env format byte for byte, and the README now says to import values as they are and to avoid $, #, quotes and spaces in new values.
stacks/gitea/docker-compose.yml:7: USER_GID=${NON_ROOT_USER_UID} uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)
roles/docker_stack/tasks/main.yml:34: a newline in a secret value would add an extra line to .env. No check refuses it. (nit)
roles/docker_stack/tasks/main.yml:32: no_log also hides the cause when the OpenBao login, the read or the rendering fails. (nit)
roles/docker_stack/tasks/main.yml:39: deleting a stack's env.j2 leaves its old .env on the host. (nit)
roles/docker_stack/tasks/main.yml:23: set_fact keeps the secrets as a host fact for the rest of the play. Task-level vars on the template task would scope them to that one task. (nit)
stacks/gitea/env.j2:1: the header comment hardcodes secret/docker/gitea, though the mount and path are variables. (nit)
<!-- claude-review: pass 69a1c0a9fb8bb62e0304d7d64fcb7fae83036c2e -->
## Review
Effort: medium
The earlier quoting finding is resolved: values are rendered unquoted on purpose, matching the live `.env` format byte for byte, and the README now says to import values as they are and to avoid `$`, `#`, quotes and spaces in new values.
- `stacks/gitea/docker-compose.yml:7`: `USER_GID=${NON_ROOT_USER_UID}` uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)
- `roles/docker_stack/tasks/main.yml:34`: a newline in a secret value would add an extra line to `.env`. No check refuses it. (nit)
- `roles/docker_stack/tasks/main.yml:32`: `no_log` also hides the cause when the OpenBao login, the read or the rendering fails. (nit)
- `roles/docker_stack/tasks/main.yml:39`: deleting a stack's `env.j2` leaves its old `.env` on the host. (nit)
- `roles/docker_stack/tasks/main.yml:23`: `set_fact` keeps the secrets as a host fact for the rest of the play. Task-level `vars` on the template task would scope them to that one task. (nit)
- `stacks/gitea/env.j2:1`: the header comment hardcodes `secret/docker/gitea`, though the mount and path are variables. (nit)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What changes
docker_stackrole renders a stack's.envfrom OpenBao whenstacks/<stack>/env.j2exists. It readsdocker/<stack>from the KV engine with an AppRole login, writes.envwith mode600, and usesno_loganddiff: falseso values never reach the job log. Stacks without anenv.j2behave as before.community.hashi_vault7.1.0 is added to the collection requirements.inventory/group_vars/all.ymlreads the OpenBao address and AppRole credentials from files on the ansible LXC, so no hostname or credential is committed.stacks/gitea/env.j2lists its variables, andplaybooks/gitea.ymldeploys it.Why
Secrets have to stay out of this repo, which is meant to become public. Gitea gets its own playbook because it runs the deploy pipeline: no workflow calls
playbooks/gitea.yml, so it is only run by hand from the ansible LXC.Deploy effect
Merging triggers Deploy Stacks, which runs
docker_stacks.yml(it-tools only). it-tools has noenv.j2, so it does not contact OpenBao. Gitea is not deployed by the merge.Review
Effort: medium
stacks/gitea/env.j2:7: values are written to.envunquoted and unescaped, and the README tells you to strip quotes on import. A secret containing$,#, quotes or a newline is changed by Compose:$wordis interpolated and#...is dropped as a comment. That would give Gitea the wrong DB password. (important)README.md:41: the secret files are readable only by the runner user, butplaybooks/gitea.ymlis run by hand. The README doesn't say to run it as the runner user, so a manual run fails with permission denied on the lookup. (nit)stacks/gitea/docker-compose.yml:7:USER_GID=${NON_ROOT_USER_UID}uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)roles/docker_stack/tasks/main.yml:41:no_logalso hides which key is missing when the template fails to render. (nit)roles/docker_stack/tasks/main.yml:34: deleting a stack'senv.j2leaves its old.envon the host. (nit)README.md:63: the jq import keeps\rfrom CRLF files and inline comments, and skipsexportlines. (nit)Review
Effort: medium
The earlier quoting finding is resolved: values are rendered unquoted on purpose, matching the live
.envformat byte for byte, and the README now says to import values as they are and to avoid$,#, quotes and spaces in new values.stacks/gitea/docker-compose.yml:7:USER_GID=${NON_ROOT_USER_UID}uses the UID variable for the GID. It was copied from the live file as-is. (pre-existing)roles/docker_stack/tasks/main.yml:34: a newline in a secret value would add an extra line to.env. No check refuses it. (nit)roles/docker_stack/tasks/main.yml:32:no_logalso hides the cause when the OpenBao login, the read or the rendering fails. (nit)roles/docker_stack/tasks/main.yml:39: deleting a stack'senv.j2leaves its old.envon the host. (nit)roles/docker_stack/tasks/main.yml:23:set_factkeeps the secrets as a host fact for the rest of the play. Task-levelvarson the template task would scope them to that one task. (nit)stacks/gitea/env.j2:1: the header comment hardcodessecret/docker/gitea, though the mount and path are variables. (nit)