derive app_templates_path from ansible_parent_role_paths

This commit is contained in:
2026-07-16 22:29:59 -04:00
parent f045c43f8e
commit eece28d2b1
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -298,8 +298,8 @@ These variables have no defaults and must be set by the calling playbook (typica
|----------|-------------|-------------|
| `host_root_path` | Base directory on the **target host** under which each app's directory is created (e.g. `/srv/apps`, `/opt/docker`) | `app_dir` |
| `backup_path` | Base directory on the **controller** where fetched backup archives are stored (e.g. `~/backups`) | `app_backup_path` |
| `app_roles_path` | Absolute path to the roles directory that contains your per-app shim roles; used so this role can locate the shim role's `templates/` directory (e.g. `{{ playbook_dir }}/roles`) | `app_templates_path` |
| `app_role_name` | Name of the per-app shim role that depends on this one (e.g. `my-app`, `jellyfin`); combined with `app_roles_path` to find its `templates/` directory | `app_templates_path` |
The `templates/` directory of the calling shim role is discovered automatically via `ansible_parent_role_paths` — no path variable to set.
### Core Variables
+4 -1
View File
@@ -30,7 +30,10 @@ app_health_check_retries: 30
app_health_check_delay: 10
app_health_check_status_codes: [200, 201, 202]
app_templates_path: "{{ app_roles_path + '/' + app_role_name }}/templates"
# Templates path derives from the caller (shim) role's directory, so shim
# roles in any collection layout Just Work. ansible_parent_role_paths[0] is
# the absolute path of the role that pulled this one in as a dep.
app_templates_path: "{{ ansible_parent_role_paths[0] }}/templates"
app_compose_template: "{{ app_templates_path }}/compose.yml.j2"
app_subdirectories: []