aboutsummaryrefslogtreecommitdiffstats
path: root/roles/git/tasks
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-04-09 20:32:05 -0400
committerbnewbold <bnewbold@robocracy.org>2016-04-09 20:32:05 -0400
commitdfe67bab68bdab77dd8acbf3c4b1dcb7b7de515f (patch)
treecee30439a361c265e9ed53e371e0787babd8dab1 /roles/git/tasks
parent449688096d3cda8e0ea843fe0a8bbf76ff7bd94a (diff)
downloadinfra-dfe67bab68bdab77dd8acbf3c4b1dcb7b7de515f.tar.gz
infra-dfe67bab68bdab77dd8acbf3c4b1dcb7b7de515f.zip
git: first-pass cgit/gitolite configuration
Diffstat (limited to 'roles/git/tasks')
-rw-r--r--roles/git/tasks/cgit.yml73
-rw-r--r--roles/git/tasks/gitolite.yml13
2 files changed, 36 insertions, 50 deletions
diff --git a/roles/git/tasks/cgit.yml b/roles/git/tasks/cgit.yml
index fd9f549..3362d2c 100644
--- a/roles/git/tasks/cgit.yml
+++ b/roles/git/tasks/cgit.yml
@@ -1,59 +1,44 @@
-- name: Install cgit dependencies
+- name: Install cgit package and deps (fcgi stuff)
apt: pkg={{ item }} state=installed
with_items:
- - groff
- - libssl-dev
- - python-pip
+ - cgit
+ - fcgiwrap
+ - spawn-fcgi
tags:
- dependencies
-- name: Install cgit pip dependencies
- pip: name={{ item }}
- with_items:
- - docutils
- - pygments
-
-- name: Download cgit release
- get_url: url=http://git.zx2c4.com/cgit/snapshot/cgit-{{ cgit_version }}.tar.xz
- dest=/root/cgit-{{ cgit_version }}.tar.xz
-
-- name: Decompress cgit source
- unarchive: src=/root/cgit-{{ cgit_version }}.tar.xz
- dest=/root copy=no
- creates=/root/cgit-{{ cgit_version }}/configure
-
-- name: Build and install cgit
- shell: make get-git ; make ; make install
- executable=/bin/bash
- chdir=/root/cgit-{{ cgit_version }}
- creates=/var/www/htdocs/cgit/cgit.cgi
-
- name: Copy cgitrc
template: src=etc_cgitrc.j2 dest=/etc/cgitrc
group=www-data
owner=root
-- name: Rename existing Apache cgit virtualhost
- command: mv /etc/apache2/sites-available/cgit /etc/apache2/sites-available/cgit.conf removes=/etc/apache2/sites-available/cgit
-
-- name: Remove old sites-enabled/cgit symlink (new one will be created by a2ensite)
- file: path=/etc/apache2/sites-enabled/cgit state=absent
+- name: Create static files directory
+ file: path=/srv/http/cgit
+ state=directory
+ owner=www-data
+ group=www-data
+ mode=0775
+ recurse=yes
-- name: Configure the Apache HTTP server for cgit
- template: src=etc_apache2_sites-available_cgit.j2
- dest=/etc/apache2/sites-available/cgit.conf
+- name: Upload Custom cgit Static Files (css, robots.txt, logo, etc)
+ copy: src={{ item.src }} dest={{ item.dest }}
+ group=www-data
+ owner=root
+ with_items:
+ - { src: 'robots.txt', dest: '/srv/http/cgit/robots.txt' }
+ - { src: 'cgit.png', dest: '/srv/http/cgit/cgit.png' }
+ - { src: 'cgit.css', dest: '/srv/http/cgit/cgit.css' }
+ - { src: 'favicon.ico', dest: '/srv/http/cgit/favicon.ico' }
+
+- name: Configure the nginx HTTP server for cgit
+ template: src=etc_nginx_sites-available_cgit.j2
+ dest=/etc/nginx/sites-available/cgit
group=root
owner=root
-- name: Enable Apache CGI module
- command: a2enmod cgi creates=/etc/apache2/mods-enabled/cgi.load
- notify: restart apache
-
-- name: Enable Apache rewrite module
- command: a2enmod rewrite creates=/etc/apache2/mods-enabled/rewrite.load
- notify: restart apache
-
-- name: Enable cgit site
- command: a2ensite cgit.conf creates=/etc/apache2/sites-enabled/cgit.conf
- notify: restart apache
+- name: Create symlink to enable cgit config
+ file: state=link
+ src=/etc/nginx/sites-available/cgit
+ dest=/etc/nginx/sites-enabled/cgit
+ notify: nginx reload
diff --git a/roles/git/tasks/gitolite.yml b/roles/git/tasks/gitolite.yml
index 8e2538f..09a6ac8 100644
--- a/roles/git/tasks/gitolite.yml
+++ b/roles/git/tasks/gitolite.yml
@@ -2,7 +2,7 @@
group: name=git state=present
- name: Create gitolite user
- user: name=git state=present home=/home/git system=yes group=git
+ user: name=git state=present home={{ gitolite_homedir }} system=yes group=git
- name: Add www-data to the git group
user: name=www-data groups=git append=yes
@@ -13,19 +13,20 @@
- dependencies
- name: Copy .gitolite.rc file
- copy: src=home_git_.gitolite.rc
- dest=/home/git/.gitolite.rc
+ template:
+ src=home_git_gitolite_rc.j2
+ dest={{ gitolite_homedir }}/.gitolite.rc
group=git
owner=git
mode=0644
- name: Copy SSH public key to server
- copy: src=gitolite.pub
- dest=/home/git/{{ main_user_name }}.pub
+ copy: src={{ gitolite_admin_pubkey }}
+ dest={{ gitolite_homedir}}/{{ main_user_name }}.pub
group=git
owner=git
mode=0644
- name: Setup gitolite
command: su - git -c 'gitolite setup -pk {{ main_user_name }}.pub'
- chdir=/home/git
+ chdir={{ gitolite_homedir }}