Skip to content

Instantly share code, notes, and snippets.

@alexcabrera
Created October 24, 2014 03:52
Show Gist options
  • Save alexcabrera/128c14f07f74fedc7c1c to your computer and use it in GitHub Desktop.
Save alexcabrera/128c14f07f74fedc7c1c to your computer and use it in GitHub Desktop.
Set up gitolite with Ansible
---
- name: add git user
user: name={{ git_user }} home={{ git_dir }} generate_ssh_key=yes state=present
- name: install git
apt: pkg=git-core state=latest
- name: install gitolite
apt: pkg=gitolite3 state=latest
- name: create git admin directory
file: path={{ git_admins_dir }} owner={{ git_user }} group={{ git_group }} state=directory
- name: copy admin keys
copy: src={{ item }} dest={{ git_admins_dir }}/{{ item }}.pub
with_items:
- admin.pub
- admin2.pub
- admin3.pub
- name: copy gitolite.rc
template: src=gitolite.rc.j2 dest={{ git_dir }}/.gitolite.rc
- name: make gitolite local scripts directory
file: path={{ git_dir }}/gitolite-local/hooks/repo-specific state=directory recurse=yes
- name: copy hook scripts
copy: src=static-sdk-compile
dest={{ git_dir }}/gitolite-local/hooks/repo-specific/static-sdk-compile
mode=0755
- name: set permissions on {{ git_dir }}
file: path={{ git_dir }} recurse=yes owner={{ git_user }} group={{ git_group }}
- name: configure gitolite
command: gitolite setup -pk {{ git_admins_dir }}/{{ item }} chdir={{ git_dir }}
sudo_user: git
with_items:
- admin.pub
- admin2.pub
- admin3.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment