summaryrefslogtreecommitdiff
path: root/roles/gitolite/tasks/gitolite-install.yml
blob: 5098e12c652f743347d95790289424deeddfb671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
# Execute the gitolite install. To complete the install, we need an SSH key
# (public part) that will be the admin key.

- name: Fix repository root directory owner
  file: state=directory
        path={{ repo_root }}
        owner={{ git_user }}
        group={{ git_user }}
        mode=0755

- name: Make sure {{ item }} exists
  file:
    state: directory
    path: "{{item}}"
    owner: "{{git_user}}"
    group: "{{git_user}}"
    mode: 0750
  when: hosttype == 'git-main'
  with_items:
    - /srv/gitolite/
    - /srv/gitolite/logs/
    - /srv/gitolite/local/
    - /home/{{ git_user }}/bin
    - /home/{{ git_user }}/.ssh

- name: Create symlink to the install directory
  file: state=link
        src=/srv/gitolite
        dest=/home/{{ git_user }}/.gitolite
        owner={{ git_user }}
        group={{ git_user }}
        force=yes
  when: hosttype == 'git-main'

- name: Create local hooks directory
  file: state=directory
        path=/home/{{ git_user }}/.gitolite/local/hooks/repo-specific
        owner={{ git_user }}
        group={{ git_user }}
        mode=0750
  when: hosttype == 'git-main'

- name: Create symlink to the repositories directory
  file: state=link
        src={{ repo_root }}
        dest=/home/{{ git_user }}/repositories
        owner={{ git_user }}
        group={{ git_user }}
        force=yes
  when: hosttype == 'git-main'

- name: Clone gitolite repository
  git:  repo=git://github.com/sitaramc/gitolite
        dest=/home/{{ git_user }}/gitolite
        update=yes version={{ gitolite_rev }}
        accept_hostkey=yes
  become: true
  become_user: "{{git_user}}"
  when: hosttype == "git-main"
  notify: gitolite-installation

- name: Initialize gitolite repo
  file: state=directory
        path={{ repo_root }}
        owner={{ git_user }}
        group={{ git_user }}
        mode=0755
        recurse=yes
  notify: gitolite-setup