Skip to content

Commit

Permalink
Update git remote URL before cloning on deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
fullyint committed Aug 16, 2015
1 parent 57e9d39 commit 59e8c19
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
- name: Initialize
deploy_helper: path="{{ project_root }}" state=present

- name: Check whether project source path is a git repo
stat: path={{ project_source_path }}/.git
register: git_project

- name: Get current git remote URL
command: git config --get remote.origin.url
args:
chdir: "{{ project_source_path }}"
register: remote_origin_url
when: git_project.stat.exists
changed_when: false

- name: Update git remote URL
command: git remote set-url origin {{ project_git_repo }}
args:
chdir: "{{ project_source_path }}"
when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

- name: Clone project files
git: repo="{{ project_git_repo }}"
dest="{{ project_source_path }}"
Expand Down

0 comments on commit 59e8c19

Please sign in to comment.