Created
June 17, 2013 22:41
-
-
Save BrianHicks/5801158 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set root = salt["pillar.get"]("git-remote:location", "/opt/git-remote") %} | |
git: | |
pkg.installed: | |
- pkgs: | |
- git-core | |
git-remote-directory: | |
file.directory: | |
- name: {{ root }} | |
- user: root | |
- group: root | |
{% for repo in salt["pillar.get"]("git-remote:repos", []) %} | |
{% set name = repo["name"] %} | |
{% set slug = name.replace(" ", "-").lower() %} | |
{% set path = root + "/" + slug %} | |
# create the repo | |
{{ slug }}-repo: | |
file.directory: | |
- name: {{ path }} | |
- require: | |
- file: git-remote-directory | |
cmd.run: | |
- name: "git init {{ path }} --bare" | |
- unless: "test -e {{ path }}/HEAD" | |
- require: | |
- file: {{ slug }}-repo | |
- pkg: git | |
# create hooks | |
{% for hook, content in repo.get("hooks", {}).items() %} | |
{{ slug }}-{{ hook }}: | |
file.managed: | |
- name: {{ path }}/hooks/{{ hook }} | |
- mode: 755 | |
- contents: | | |
{{ content|indent(8) }} | |
- require: | |
- cmd: {{ slug }}-repo | |
{% endfor %}{# for hooks #} | |
{% endfor %}{# for repo #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment