From 70a4225043ccae14e8053811b8e84d12e10e0587 Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Mon, 5 Nov 2018 10:21:02 +0100 Subject: fix: clever_app_root is provided & exec is outside of "parent dir" Imagine such a usecase: - project is in `/project` - executing Ansible in `/ansible` with `clever_app_root: /project` will fail deploying with the git push with the following error: ``` Not a git repository (or any of the parent directories): .git" ``` This PR fixes this. --- tasks/deploy.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tasks') diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 400a79d..ca8bf15 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -26,6 +26,8 @@ - name: Push to Clever-Cloud to trigger deployment command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" + args: + chdir: "{{ clever_app_root }}" register: clever_git_push ignore_errors: true tags: @@ -33,6 +35,8 @@ - name: First time push to Clever-Cloud needs a full git clone command: "git fetch --unshallow" + args: + chdir: "{{ clever_app_root }}" when: - clever_git_push is failed - clever_git_push.stderr is search("shallow update not allowed") @@ -41,6 +45,8 @@ - name: Push to Clever-Cloud to trigger deployment command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" + args: + chdir: "{{ clever_app_root }}" when: clever_git_push is failed tags: - skip_ansible_lint -- cgit v1.2.3