From 406d4becad28110fd4c703e8f97bd9ec094785ce Mon Sep 17 00:00:00 2001 From: mg Date: Thu, 1 Jul 2021 17:37:02 +0200 Subject: [PATCH] bugfix: dotfiles - stash (#141) bugfix: dotfiles - stash Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/141 Co-Authored-By: mg Co-Committed-By: mg --- roles/mgrote.dotfiles/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/mgrote.dotfiles/tasks/main.yml b/roles/mgrote.dotfiles/tasks/main.yml index 69ecd962..8e989ec0 100644 --- a/roles/mgrote.dotfiles/tasks/main.yml +++ b/roles/mgrote.dotfiles/tasks/main.yml @@ -5,11 +5,18 @@ name: acl state: present + - name: check if repo exists + stat: + path: "{{ dotfiles_repo_path }}" + register: repo_exists + - name: stash changes ansible.builtin.shell: git stash args: chdir: "{{ dotfiles_repo_path }}" changed_when: false + when: repo_exists.stat.exists == true + register: stashed - name: Ensure dotfiles repository is cloned locally. git: @@ -23,6 +30,7 @@ args: chdir: "{{ dotfiles_repo_path }}" changed_when: false + when: stashed.changed - name: set owner recursive for repo file: