ansible/ansible — pull request #7112 by kolbyjack (2014-04-22 13:51:34+00:00)
Title: add git_dir option to git module to allow external repository dir

Tested using the below playbook, using one repository without submodules, and one with.

---
- name: reset repositories
command: rm -rf /home/ansible/git

- name: fetch repositories without git_dir
git: >
repo=https://github.com/{{ item[0] }}.git
version={{ item[1] }}
dest=/home/ansible/git/combined/{{ item[0] }}
with_nested:
- ['joyent/http-parser', 'ShareKit/ShareKit']
- ['HEAD', 'v2.3', 'v2.0']

- name: fetch repositories with git_dir
git: >
repo=https://github.com/{{ item[0] }}.git
version={{ item[1] }}
dest=/home/ansible/git/work_tree/{{ item[0] }}
git_dir=/home/ansible/git/git_dir/{{ item[0] }}.git
with_nested:
- ['joyent/http-parser', 'ShareKit/ShareKit']
- ['HEAD', 'v2.3', 'v2.0']

- name: reset repositories
command: rm -rf /home/ansible/git

- name: fetch repositories without git_dir
git: >
repo=https://github.com/{{ item[0] }}.git
version={{ item[1] }}
dest=/home/ansible/git/combined/{{ item[0] }}
with_nested:
- ['joyent/http-parser', 'ShareKit/ShareKit']
- ['v2.3', 'HEAD', 'v2.0']

- name: fetch repositories with git_dir
git: >
repo=https://github.com/{{ item[0] }}.git
version={{ item[1] }}
dest=/home/ansible/git/work_tree/{{ item[0] }}
git_dir=/home/ansible/git/git_dir/{{ item[0] }}.git
with_nested:
- ['joyent/http-parser', 'ShareKit/ShareKit']
- ['v2.3', 'HEAD', 'v2.0']

- name: git_dir and bare defined together
git: >
repo=https://github.com/{{ item[0] }}.git
version={{ item[1] }}
dest=/home/ansible/git/work_tree/{{ item[0] }}
git_dir=/home/ansible/git/git_dir/{{ item[0] }}.git
with_nested:
- ['joyent/http-parser', 'ShareKit/ShareKit']
- ['v2.3', 'HEAD', 'v2.0']