Browse Source

add gitweb role

master
cinnaboot 5 years ago
parent
commit
905db417d2
  1. 5
      all.yml
  2. 0
      roles/baikal/tasks/main.yml
  3. 50
      roles/gitweb/tasks/main.yml
  4. 23
      roles/gitweb/templates/custom_highlighting.css.j2
  5. 15
      roles/gitweb/templates/gitweb.conf.j2
  6. 43
      roles/gitweb/templates/lighttpd.conf.j2

5
all.yml

@ -24,3 +24,8 @@
- hosts: gallery - hosts: gallery
tags: containers, gallery tags: containers, gallery
roles: [flask] roles: [flask]
- hosts: gitweb
tags: containers, gitweb
roles: [gitweb]

0
roles/baikal/tasks/main.yml

50
roles/gitweb/tasks/main.yml

@ -0,0 +1,50 @@
---
- name: install packages
apk:
name:
- lighttpd
- git-gitweb
- highlight
- perl-cgi
state: present
- name: main block
vars:
lighttpd_user: lighttpd
lighttpd_group: lighttpd
http_port: 80
gitweb_user: gitweb
gitweb_root: /home/gitweb/projects
gitweb_stylesheet: custom_highlighting.css
block:
- name: add gitweb user
user:
name: "{{ gitweb_user }}"
- name: create project directory
file:
path: "{{ gitweb_root }}"
state: directory
owner: "{{ gitweb_user }}"
- name: install lighttpd template
template:
src: lighttpd.conf.j2
dest: /etc/lighttpd/lighttpd.conf
- name: install gitweb template
template:
src: gitweb.conf.j2
dest: /etc/gitweb.conf
- name: install gitweb stylesheet
template:
src: "{{ gitweb_stylesheet }}.j2"
dest: "/usr/share/gitweb/static/{{ gitweb_stylesheet }}"
- name: enable and (re)start lighttpd
service:
name: lighttpd
enabled: yes
state: restarted

23
roles/gitweb/templates/custom_highlighting.css.j2

@ -0,0 +1,23 @@
.pre {
background-color: #333;
color: #eee;
}
/* Style definition file generated by highlight 3.52, http://www.andre-simon.de/ */
/* highlight theme: vim zenburn */
.num { color:#dca3a3; font-weight:bold; }
.esc { color:#dca3a3; font-weight:bold; }
.str { color:#cc9393; }
.pps { color:#cc9393; }
.slc { color:#7f9f7f; font-style:italic; }
.com { color:#7f9f7f; font-style:italic; }
.ppc { color:#ffcfaf; font-weight:bold; }
.opt { color:#dcdccc; }
.ipl { color:#c07abe; }
.lin { color:#9fafaf; }
.kwa { color:#e3ceab; }
.kwb { color:#dfdfbf; font-weight:bold; }
.kwc { color:#aae3b2; }
.kwd { color:#aabfe3; }

15
roles/gitweb/templates/gitweb.conf.j2

@ -0,0 +1,15 @@
# The directories where your projects are. Must not end with a slash.
$projectroot = "{{gitweb_root}}";
# Base URLs for links displayed in the web interface.
#@git_base_url_list = qw(git://{{ansible_host}} http://{{ansible_host}});
# syntax highlighting
#$highlight_bin = "/usr/bin/highlight";
$feature{'highlight'}{'default'} = [1];
$site_name = 'git';
push @stylesheets, "static/{{gitweb_stylesheet}}";

43
roles/gitweb/templates/lighttpd.conf.j2

@ -0,0 +1,43 @@
var.basedir = "/var/www/localhost"
var.logdir = "/var/log/lighttpd"
var.statedir = "/var/lib/lighttpd"
server.modules = (
"mod_redirect",
"mod_alias",
"mod_access",
"mod_accesslog",
"mod_cgi",
"mod_setenv"
)
server.port = "{{ http_port }}"
server.username = "{{ lighttpd_user }}"
server.groupname = "{{ lighttpd_group }}"
server.document-root = var.basedir + "/htdocs"
server.pid-file = "/run/lighttpd.pid"
server.errorlog = var.logdir + "/error.log"
server.follow-symlink = "disable"
accesslog.filename = var.logdir + "/access.log"
dir-listing.activate = "enable"
url.access-deny = ("~", ".inc")
#
# gitweb
#
include "mime-types.conf"
url.redirect += ( "^/gitweb$" => "/gitweb/" )
alias.url += ( "/gitweb" => "/usr/share/gitweb/" )
$HTTP["url"] =~ "^/gitweb/" {
setenv.add-environment = (
"GITWEB_CONFIG" => "/etc/gitweb.conf",
"PATH" => env.PATH
)
cgi.assign = ( ".cgi" => "" )
server.indexfiles = ( "gitweb.cgi" )
}
Loading…
Cancel
Save