Browse code

Prepare for integration with a webserver

Robert Cranston authored on 17/11/2019 11:34:33
Showing 4 changed files

... ...
@@ -5,8 +5,9 @@ An [Ansible][] [role][] for deploying [gitolite][] on [Debian][] >=9.
5 5
 Installs [gitolite][], creates a [dedicated user][] to run it (defaults to
6 6
 `git`), prepares for [administering gitolite directly on the server][], allows
7 7
 (explicit) [user created repos][] with [multiple `OWNERS`][] and `user/USER/*`
8
-[personal branches][] for `USERS`, and allows users to run [`symbolic-ref`][]
9
-(e.g. to change `HEAD`, the default branch).
8
+[personal branches][] for `USERS`, allows users to run [`symbolic-ref`][] (e.g.
9
+to change `HEAD`, the default branch), and prepares for [integration with a
10
+webserver][].
10 11
 
11 12
 [`ansible-role-gitolite`]: https://git.rcrnstn.net/rcrnstn/ansible-role-gitolite
12 13
 [Ansible]: https://docs.ansible.com/ansible
... ...
@@ -19,6 +20,7 @@ Installs [gitolite][], creates a [dedicated user][] to run it (defaults to
19 20
 [multiple `OWNERS`]: https://gitolite.com/gitolite/wild#specifying-owners
20 21
 [personal branches]: https://gitolite.com/gitolite/user#personal-branches
21 22
 [`symbolic-ref`]: https://git-scm.com/docs/git-symbolic-ref
23
+[integration with a webserver]: https://gitolite.com/gitolite/gitweb-daemon.html
22 24
 
23 25
 ## Try out
24 26
 
... ...
@@ -1,4 +1,6 @@
1 1
 ---
2 2
 
3 3
 gitolite_user_name: "git"
4
+gitolite_user_group: "{{ gitolite_user_name }}"
4 5
 gitolite_user_home: "/home/{{ gitolite_user_name }}"
6
+gitolite_webserver_user_name: "www-data"
... ...
@@ -18,7 +18,7 @@
18 18
 
19 19
     # default umask gives you perms of '0700'; see the rc file docs for
20 20
     # how/why you might change this
21
-    UMASK                           =>  0077,
21
+    UMASK                           =>  0027,
22 22
 
23 23
     # look for "git-config" in the documentation
24 24
     GIT_CONFIG_KEYS                 =>  '',
... ...
@@ -165,7 +165,7 @@
165 165
             # 'upstream',
166 166
 
167 167
             # updates 'description' file instead of 'gitweb.description' config item
168
-            # 'cgit',
168
+            'cgit',
169 169
 
170 170
             # allow repo-specific hooks to be added
171 171
             # 'repo-specific-hooks',
... ...
@@ -17,9 +17,16 @@
17 17
     - name: "Create gitolite user '{{ gitolite_user_name }}'"
18 18
       user:
19 19
         name: "{{ gitolite_user_name }}"
20
+        group: "{{ gitolite_user_group }}"
20 21
         home: "{{ gitolite_user_home }}"
21 22
         shell: "/bin/bash"
22 23
 
24
+    - name: "Add '{{ gitolite_webserver_user_name }}' to the '{{ gitolite_user_group }}' group"
25
+      user:
26
+        name: "{{ gitolite_webserver_user_name }}"
27
+        groups: "{{ gitolite_user_group }}"
28
+        append: yes
29
+
23 30
 - become: yes
24 31
   become_user: "{{ gitolite_user_name }}"
25 32
   vars:
... ...
@@ -71,3 +78,13 @@
71 78
               RW+ user/USER/ = USERS
72 79
               RW = WRITERS
73 80
               R = READERS
81
+
82
+    - name: "Allow group read access to gitolite files"
83
+      file:
84
+        path: "{{ item }}"
85
+        mode: 'g+rX'
86
+        recurse: yes
87
+        state: 'directory'
88
+      loop:
89
+        - "{{ gitolite_user_home }}/repositories"
90
+        - "{{ gitolite_user_home }}/.gitolite"