f939f92c |
---
- become: yes
block:
- name: "Install gitolite"
apt:
name: 'gitolite3'
state: 'present'
|
ae125be2 |
|
c13e1cf7 |
# https://docs.ansible.com/ansible/latest/user_guide/become.html#risks-of-becoming-an-unprivileged-user
- name: "Install acl"
apt:
name: 'acl'
state: 'present'
|
ae125be2 |
- name: "Create gitolite user '{{ gitolite_user_name }}'"
user:
name: "{{ gitolite_user_name }}"
home: "{{ gitolite_user_home }}"
shell: "/bin/bash"
|
c13e1cf7 |
- become: yes
become_user: "{{ gitolite_user_name }}"
vars:
default_repos:
- "gitolite-admin"
- "testing"
block:
- name: "Run dummy setup"
command:
cmd: "gitolite setup -a dummy"
creates: "{{ gitolite_user_home }}/.gitolite"
- name: "Remove directories of default repos"
file:
path: "{{ gitolite_user_home }}/repositories/{{ item }}.git"
state: 'absent'
notify: 'gitolite compile'
loop: "{{ default_repos }}"
- name: "Remove config of default repos"
replace:
path: "{{ gitolite_user_home }}/.gitolite/conf/gitolite.conf"
regexp: '^[ \t\n]*repo[ \t]+{{ item }}((?!^repo)(.|\n))*'
notify: 'gitolite compile'
loop: "{{ default_repos }}"
- name: "Create keydir"
file:
path: "{{ gitolite_user_home }}/.gitolite/keydir"
state: 'directory'
notify: 'gitolite compile'
|
c4517a83 |
- name: "Write gitolite.rc"
copy:
src: "gitolite.rc"
dest: "{{ gitolite_user_home }}/.gitolite.rc"
notify: 'gitolite compile'
|
7fd652b3 |
- name: "Allow user created repos"
blockinfile:
path: "{{ gitolite_user_home }}/.gitolite/conf/gitolite.conf"
marker: "# {mark} User created repos"
block: |
|
bf85b040 |
repo CREATOR/[^/]+
|
7fd652b3 |
C = @all
RW+ = CREATOR
|
89167e91 |
RW+ = OWNERS
|
81d341ec |
RW+ user/USER/ = USERS
|
7fd652b3 |
RW = WRITERS
R = READERS
|