summaryrefslogtreecommitdiff
path: root/roles/gitserver
diff options
context:
space:
mode:
Diffstat (limited to 'roles/gitserver')
-rw-r--r--roles/gitserver/tasks/as_gituser.yaml5
-rw-r--r--roles/gitserver/tasks/main.yaml16
-rw-r--r--roles/gitserver/templates/website-post-update-hook.j23
3 files changed, 24 insertions, 0 deletions
diff --git a/roles/gitserver/tasks/as_gituser.yaml b/roles/gitserver/tasks/as_gituser.yaml
index 69157fd..9c4b67c 100644
--- a/roles/gitserver/tasks/as_gituser.yaml
+++ b/roles/gitserver/tasks/as_gituser.yaml
@@ -11,3 +11,8 @@
- name: Initialize gitolite and restore backup
include: restore_gitolite.yaml
when: not gitolite_dir.stat.exists
+
+- name: Put Post-update-hook for website
+ template: dest=/var/lib/gitolite/repositories/website.git/hooks/post-update
+ mode=0755
+ src=website-post-update-hook.j2
diff --git a/roles/gitserver/tasks/main.yaml b/roles/gitserver/tasks/main.yaml
index aca95f4..7143c64 100644
--- a/roles/gitserver/tasks/main.yaml
+++ b/roles/gitserver/tasks/main.yaml
@@ -13,6 +13,20 @@
name=git
group=git
home="/var/lib/gitolite"
+ generate_ssh_key=yes
+
+- name: Get Webserver Hostkey
+ slurp: src=/etc/ssh/ssh_host_ecdsa_key.pub
+ register: webserver_host_key
+ delegate_to: "{{groups['webservers'][0]}}"
+
+- name: Put Webserver Hostkey into knownhosts
+ lineinfile: dest=/var/lib/gitolite/.ssh/known_hosts
+ create=yes
+ owner=git
+ group=git
+ mode=0644
+ line="{{groups['webservers'][0]}} {{webserver_host_key.content|b64decode}}"
- name: Make git dir world readable
file:
@@ -32,6 +46,8 @@
- name: Ensure correct permissions on cgitrc.repo_service
file:
name=/etc/cgitrc.repo_service
+ owner=repo_service
+ group=repo_service
mode=0644
- name: Configure git-daemon
diff --git a/roles/gitserver/templates/website-post-update-hook.j2 b/roles/gitserver/templates/website-post-update-hook.j2
new file mode 100644
index 0000000..bdc655e
--- /dev/null
+++ b/roles/gitserver/templates/website-post-update-hook.j2
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ssh git_server_rpc@{{groups['webservers'][0]}} sudo /var/www/{{sublab_web_server_name}}/website-rebuild.sh