diff --git a/roles/app/README.md b/roles/app/README.md index db271b2..bc1ddda 100644 --- a/roles/app/README.md +++ b/roles/app/README.md @@ -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 diff --git a/roles/app/defaults/main.yml b/roles/app/defaults/main.yml index 6eba637..6a49c69 100644 --- a/roles/app/defaults/main.yml +++ b/roles/app/defaults/main.yml @@ -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: []