fix: [#409] replace hardcoded /opt/torrust paths with deploy_dir variable in Ansible templates#420
Merged
josecelano merged 1 commit intomainfrom Apr 7, 2026
Conversation
…able in Ansible templates
Member
Author
|
ACK 7365df3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #409 — Several Ansible playbook templates under
templates/ansible/were hardcoding the deployment directory as/opt/torrustinstead of using the{{ deploy_dir }}variable fromvariables.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/torrustpaths replaced with{{ deploy_dir }}:templates/ansible/create-tracker-storage.yml— 3 loop itemstemplates/ansible/create-prometheus-storage.yml— 1 loop itemtemplates/ansible/create-backup-storage.yml— 2path:paramstemplates/ansible/deploy-backup-config.yml— 4dest:andpath:paramstemplates/ansible/deploy-tracker-config.yml— 2dest:andpath:paramstemplates/ansible/deploy-prometheus-config.yml— 2dest:andpath:paramstemplates/ansible/init-tracker-database.yml— 2path:paramstemplates/ansible/deploy-caddy-config.yml— 6 loop items +dest:+path:Phase 2: Fix inline-variable templates
templates/ansible/run-compose-services.yml— Removed inlinevars: deploy_dir: /opt/torrust; addedvars_files: [variables.yml]templates/ansible/deploy-compose-files.yml— Removed inlinevars: remote_deploy_dir: /opt/torrust; addedvars_files: [variables.yml]; renamed allremote_deploy_dirreferences todeploy_dirPhase 3: Update comments
Updated inline comments in modified templates to reference
{{ deploy_dir }}instead of/opt/torrustexample paths.Acceptance Criteria
templates/ansible/uses a hardcoded/opt/torrustpath inpath:,dest:, or loop itemsvariables.ymlviavars_filesdeploy_diris used consistently (noremote_deploy_diror other aliases)vars:blocks for the deploy directory no longer define it inlinedeploy_dir: /opt/torrust) is unchangedcargo run --bin linter yaml)