From 2f98c52300246750127ed052e04cf919f840c804 Mon Sep 17 00:00:00 2001 From: Michael Schiemer Date: Sat, 8 Nov 2025 15:04:20 +0100 Subject: [PATCH] refactor: Simplify git_repo_url logic - Use single set_fact task with ternary operator - Cleaner and more efficient than multiple conditional tasks --- .../ansible/playbooks/deploy-application-code.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/deployment/ansible/playbooks/deploy-application-code.yml b/deployment/ansible/playbooks/deploy-application-code.yml index f03e9fb4..e5c0b322 100644 --- a/deployment/ansible/playbooks/deploy-application-code.yml +++ b/deployment/ansible/playbooks/deploy-application-code.yml @@ -19,20 +19,9 @@ deployment_environment: "{{ deployment_environment | default('production') }}" tasks: - - name: Set git_repository_url if not provided + - name: Set git_repo_url from provided value or default set_fact: - git_repo_url: "{{ git_repository_url | default(git_repository_url_default) }}" - when: git_repository_url is not defined or git_repository_url == "" - - - name: Use default git_repository_url if not set - set_fact: - git_repo_url: "{{ git_repository_url_default }}" - when: git_repository_url is not defined or git_repository_url == "" - - - name: Use provided git_repository_url if set - set_fact: - git_repo_url: "{{ git_repository_url }}" - when: git_repository_url is defined and git_repository_url != "" + git_repo_url: "{{ git_repository_url if (git_repository_url is defined and git_repository_url != '') else git_repository_url_default }}" - name: Ensure Git is installed ansible.builtin.apt: