From 97554746998e135124d2f02bff4d857d5a2d41fc Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 3 Oct 2015 23:14:59 +0300
Subject: [PATCH] Use a variable for the location of the git repositories
 directory instead of a hard-coded value. Also owned by root:root instead of
 root:www-data since it's world writable.

---
 README.rst        | 3 ++-
 defaults/main.yml | 1 +
 tasks/main.yml    | 6 +++---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.rst b/README.rst
index 135d444..8ca3deb 100644
--- a/README.rst
+++ b/README.rst
@@ -11,7 +11,8 @@ Debian Jessie.
 Role Variables
 --------------
 
-None.
+git_directory: The directory to be created and used for all git repositories
+               served.
 
 Dependencies
 ------------
diff --git a/defaults/main.yml b/defaults/main.yml
index 09f250f..3508c03 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,2 +1,3 @@
 ---
 # defaults file for ansible-cgit
+git_directory: /srv/git
diff --git a/tasks/main.yml b/tasks/main.yml
index 1af670c..a579775 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -29,9 +29,9 @@
 
 - name: Create git repostories directory
   file:
-      path: /srv/git
+      path: '{{ git_directory }}'
       owner: root
-      group: www-data
+      group: root
       mode: '0777'
       state: directory
 
@@ -50,7 +50,7 @@
       regexp: '{{ item.regexp|default(omit) }}'
       insertbefore: '{{ item.insertbefore|default(omit) }}'
   with_items:
-      - line: 'scan-path=/srv/git'
+      - line: 'scan-path={{ git_directory }}'
         regexp: 'scan-path='
       - line: 'css=/cgit/css/cgit.css'
         regexp: '^css='
-- 
GitLab