From d52fc3576de68e2463e34ccb23943bd0307008c4 Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Mon, 4 May 2015 16:30:02 +0200 Subject: [PATCH] Run git commands on the temp folder --- .../tasks/clone_system_config_locally.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/deploy_system_config/tasks/clone_system_config_locally.yml b/roles/deploy_system_config/tasks/clone_system_config_locally.yml index c3c3658..e3405cf 100644 --- a/roles/deploy_system_config/tasks/clone_system_config_locally.yml +++ b/roles/deploy_system_config/tasks/clone_system_config_locally.yml @@ -13,11 +13,17 @@ register: checked_out_branch - command: git show-ref --verify --quiet "{{ system_config_branch }}" + args: + chdir: /tmp/infra-ansible/system-config/production register: system_config_branch_exists ignore_errors: True - command: git checkout -b "{{ system_config_branch }}" + args: + chdir: /tmp/infra-ansible/system-config/production when: system_config_branch_exists|failed - command: git checkout "{{ system_config_branch }}" + args: + chdir: /tmp/infra-ansible/system-config/production when: system_config_branch_exists|success and checked_out_branch.stdout != "{{ system_config_branch }}"