Skip to content

fix: [#409] replace hardcoded /opt/torrust paths with deploy_dir variable in Ansible templates#420

Merged
josecelano merged 1 commit intomainfrom
409-fix-hardcoded-deploy-dir-in-ansible-templates
Apr 7, 2026
Merged

fix: [#409] replace hardcoded /opt/torrust paths with deploy_dir variable in Ansible templates#420
josecelano merged 1 commit intomainfrom
409-fix-hardcoded-deploy-dir-in-ansible-templates

Conversation

@josecelano
Copy link
Copy Markdown
Member

Summary

Fixes #409 — Several Ansible playbook templates under templates/ansible/ were hardcoding the deployment directory as /opt/torrust instead of using the {{ deploy_dir }} variable from variables.yml. This caused deployment failures when a custom deployment directory was configured.

Changes

Phase 1: Fix fully hardcoded templates

All the following templates had vars_files: [variables.yml] added and all hardcoded /opt/torrust paths replaced with {{ deploy_dir }}:

  • templates/ansible/create-tracker-storage.yml — 3 loop items
  • templates/ansible/create-prometheus-storage.yml — 1 loop item
  • templates/ansible/create-backup-storage.yml — 2 path: params
  • templates/ansible/deploy-backup-config.yml — 4 dest: and path: params
  • templates/ansible/deploy-tracker-config.yml — 2 dest: and path: params
  • templates/ansible/deploy-prometheus-config.yml — 2 dest: and path: params
  • templates/ansible/init-tracker-database.yml — 2 path: params
  • templates/ansible/deploy-caddy-config.yml — 6 loop items + dest: + path:

Phase 2: Fix inline-variable templates

  • templates/ansible/run-compose-services.yml — Removed inline vars: deploy_dir: /opt/torrust; added vars_files: [variables.yml]
  • templates/ansible/deploy-compose-files.yml — Removed inline vars: remote_deploy_dir: /opt/torrust; added vars_files: [variables.yml]; renamed all remote_deploy_dir references to deploy_dir

Phase 3: Update comments

Updated inline comments in modified templates to reference {{ deploy_dir }} instead of /opt/torrust example paths.

Acceptance Criteria

  • No playbook task in templates/ansible/ uses a hardcoded /opt/torrust path in path:, dest:, or loop items
  • All playbooks that reference the deployment directory load variables.yml via vars_files
  • The variable name deploy_dir is used consistently (no remote_deploy_dir or other aliases)
  • Playbooks that previously had inline vars: blocks for the deploy directory no longer define it inline
  • The default behavior (with deploy_dir: /opt/torrust) is unchanged
  • YAML linter passes (cargo run --bin linter yaml)
  • Markdown linter passes
  • Spell checker passes

@josecelano josecelano self-assigned this Apr 6, 2026
@josecelano
Copy link
Copy Markdown
Member Author

ACK 7365df3

@josecelano josecelano merged commit 541765b into main Apr 7, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Hardcoded deployment directory in Ansible templates breaks custom deploy_dir

1 participant