Skip to content

Commit 232ada0

Browse files
update ansible git to only clone when repo isn't there (#95)
1 parent b08956f commit 232ada0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

sidecar/ansible/provision.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,25 @@
5656
command: python3.11 -m pip install --upgrade pip
5757
become: yes
5858

59+
- name: Check if directory is a git repository
60+
stat:
61+
path: '{{ ansible_env.HOME }}/draft/.git'
62+
register: git_repo
63+
5964
- name: Clone repository if it doesn't exist
6065
git:
6166
repo: 'https://github.com/private-attribution/draft.git'
6267
dest: '{{ ansible_env.HOME }}/draft'
63-
update: no
68+
when: not git_repo.stat.exists
69+
70+
71+
- name: Pull repository if it does exist
72+
git:
73+
repo: 'https://github.com/private-attribution/draft.git'
74+
dest: '{{ ansible_env.HOME }}/draft'
75+
clone: false
76+
version: main
77+
when: git_repo.stat.exists
6478

6579
- name: Create virtualenv if it doesn't exist
6680
command: python3.11 -m venv .venv

0 commit comments

Comments
 (0)