From a7b611f5a9c28c732d9385809af21abb21eace03 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Tue, 1 Sep 2020 21:38:01 -0400 Subject: [PATCH] Only concatenate default_templates_dir when necessary By default the default_templates_dir is appended to the plan_environment file. This is fine unless the deployer overrides the default plan_environment file with the -p option. This patch adds jinja2 filters so that if the plan_environment starts with a '/', then the default templates directory is not appended. Otherwise the default behavior is unchanged. Change-Id: I5341da7fdea0a53b86295d74d68ef2013efb0ea0 Closes-Bug: #1893861 (cherry picked from commit 295555839c5e1d8e7e5ab1bb3fb39537d09da989) --- .../playbooks/cli-create-deployment-plan.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tripleo_ansible/playbooks/cli-create-deployment-plan.yaml b/tripleo_ansible/playbooks/cli-create-deployment-plan.yaml index 6b677d6b9..e33a501b0 100644 --- a/tripleo_ansible/playbooks/cli-create-deployment-plan.yaml +++ b/tripleo_ansible/playbooks/cli-create-deployment-plan.yaml @@ -90,12 +90,18 @@ when: use_default_templates or source_url is not none - - name: Create plan environment if does not exit + # If plan_environment is an absolute path, then + # don't prepend the templates dir. Else prepend it. + - name: Create plan environment if does not exist os_object: container: "{{ container }}" name: plan-environment.yaml - filename: "{{ default_templates_dir + plan_environment }}" state: present + filename: >- + {{ plan_environment.startswith('/') + | ternary(plan_environment, + default_templates_dir.rstrip('/') + + '/' + plan_environment) }} - name: Generate passwords and update plan tripleo_passwords_rotate: