Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update git remote URL before cloning on deploys #299

Merged
merged 1 commit into from
Aug 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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