- Python 47.8%
- Shell 47.7%
- Jinja 3.3%
- PowerShell 1.2%
- move every helper into a functional folder (docker, infra, media, mediaserver, o2, stash) - add templates/retry-vm.sh.j2 (rendered by Ansible into infra/) - drop rclone-healthcheck.sh (superseded by the Ansible rclone role) - read credentials from env vars or /etc/script-secrets (no secrets in the repo) - document the convention in README.md and AGENTS.md |
||
|---|---|---|
| docker | ||
| infra | ||
| media | ||
| mediaserver | ||
| o2 | ||
| stash | ||
| templates | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
scripts
Helper scripts for the home lab (Proxmox host trastero01 and the services it runs).
This repository is the single source of truth for the scripts deployed in /mnt/scripts.
The Ansible role scripts (repo cescm/ansible) clones this repo into /mnt/repos/scripts
and deploys the content into /mnt/scripts, keeping the functional folders.
Layout
One folder per functional area:
| Folder | Purpose |
|---|---|
docker/ |
Docker host helpers (config and volume backups) |
infra/ |
Infrastructure helpers (Forgejo workflow dispatch, OCI VM bootstrap) |
media/ |
Media library helpers (compression, CBR conversion, quarantine restore) |
mediaserver/ |
Jellyfin / Tubearchivist helpers |
o2/ |
Oracle Cloud (OCI) session capture and monitoring |
stash/ |
Stash media management helpers |
templates/ |
Jinja2 templates rendered by Ansible (retry-vm.sh.j2 → infra/) |
Secrets
No credential is ever stored in this repository. Scripts read secrets in this order:
- Environment variable (
GUARDOG_TOKEN,JELLYFIN_API_KEY,ES_PASSWORD). - File in
/etc/script-secrets/<name>(root:root, mode0600), deployed by Ansible from the encrypted variables ingroup_vars/proxmox/vault.yml.
| Secret file | Variable | Used by |
|---|---|---|
/etc/script-secrets/guardog_token |
GUARDOG_TOKEN |
infra/trigger-guardog.sh |
/etc/script-secrets/jellyfin_api_key |
JELLYFIN_API_KEY |
mediaserver/missing.py |
/etc/script-secrets/es_password |
ES_PASSWORD |
mediaserver/ta_export.py |
If a secret is missing the script fails fast with a clear error instead of sending an unauthenticated request.
Deployment
ansible-playbook playbook.yml --tags scripts
The role clones https://forgejo.caprichosdelucia.com/cescm/scripts.git into
/mnt/repos/scripts (public repository, no credentials needed), copies the functional
folders to /mnt/scripts and renders templates/retry-vm.sh.j2 into
/mnt/scripts/infra/retry-vm.sh.
Adding a new script
- Put it in the folder that matches its function.
- Keep it idempotent and safe to re-run.
- Never hardcode credentials: use
/etc/script-secrets/<name>. - If it needs parameters from the infrastructure (OCI OCIDs, IPs), add a
.j2template undertemplates/instead of hardcoding them in the script. - Commit and push; the next Ansible run deploys it.
The same convention is recorded in AGENTS.md for AI agents working on this repository.