Created
October 24, 2014 16:15
-
-
Save alexcabrera/b08cf8bfcf2dda181470 to your computer and use it in GitHub Desktop.
Ansible tasks for provisioning a multi-admin gitolite setup
This file contains 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
--- | |
- name: add git user | |
user: name={{ git_user }} home={{ git_dir }} generate_ssh_key=yes state=present | |
- name: install apt pacakges | |
apt: pkg={{ item }} state=latest | |
with_items: | |
- git-core | |
- gitolite3 | |
- 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: run mock setup | |
command: gitolite setup -a dummy | |
- name: remove gitolite-admin repository | |
file: path={{ git_dir }}/repositories/gitolite-admin.git state=absent | |
- name: create gitolite directories | |
file: path={{ git_dir }}/.gitolite/{{ item }} state=directory | |
with_items: | |
- keydir | |
- conf | |
- logs | |
- name: create repositories directory | |
file: path={{ git_dir }}/repositories state=directory | |
- name: copy gitolite.conf file | |
template: src=gitolite.conf.j2 dest={{ git_dir }}/.gitolite/conf/gitolite.conf | |
- name: copy admin keys | |
copy: src={{ item }} dest={{ git_dir }}/.gitolite/keydir/{{ item }} | |
with_items: | |
- admin1.pub | |
- admin2.pub | |
- admin3.pub | |
- name: add admins to authorized_keys | |
authorized_key: user="{{ git_user }}" key="{{ item }}" | |
with_file: | |
- admin1.pub | |
- admin2.pub | |
- admin3.pub | |
- name: compile gitolite | |
command: "{{ item }}" | |
with_items: | |
- gitolite compile | |
- gitolite trigger POST_COMPILE | |
- name: set permissions on {{ git_dir }} | |
file: path={{ git_dir }} recurse=yes owner={{ git_user }} group={{ git_group }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment