aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-12-03 18:07:10 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-12-03 18:07:10 -0200
commit54eacd438e5fc4fb5618db553cee2594b2145c0e (patch)
tree92c18fe06780930df2d5f1911b72cc1fae7af19b
parent3134368c41cc0279499e2112e9ee4334b0f63d3d (diff)
downloadpuppet-git-54eacd438e5fc4fb5618db553cee2594b2145c0e.tar.gz
puppet-git-54eacd438e5fc4fb5618db553cee2594b2145c0e.tar.bz2
Initial gitolite support
-rw-r--r--manifests/gitolite.pp87
-rw-r--r--manifests/init.pp1
2 files changed, 88 insertions, 0 deletions
diff --git a/manifests/gitolite.pp b/manifests/gitolite.pp
new file mode 100644
index 0000000..4dddd2b
--- /dev/null
+++ b/manifests/gitolite.pp
@@ -0,0 +1,87 @@
+# This class handles a gitolite installation, with /var/git as the root for
+# git repositories.
+
+class gitolite inherits git {
+ # directory for gitolite user and repositories
+ file { "/var/git":
+ ensure => directory,
+ mode => 0755,
+ owner => gitolite,
+ group => gitolite,
+ }
+
+ # repositories folder
+ file { "/var/git/repositories":
+ ensure => directory,
+ owner => gitolite,
+ group => gitolite,
+ mode => 0755,
+ recurse => false,
+ }
+
+ # symbolic link
+ file { "/var/cache/git":
+ ensure => "/var/git/repositories",
+ force => true,
+ backup => false,
+ require => File['/var/git/repositories'],
+ }
+
+ # the needed packages
+ package { "gitolite": ensure => installed }
+
+ # ensures that the group exists
+ group { "gitolite":
+ ensure => present,
+ allowdupe => false,
+ require => Package["gitolite"],
+ }
+
+ # alters the user's home dir
+ user { "gitolite":
+ allowdupe => false,
+ comment => "git repository hosting,,,",
+ ensure => present,
+ home => "/var/git",
+ shell => "/bin/sh",
+ gid => "gitolite",
+ groups => [ "puppet" ],
+ require => Group["gitolite"],
+ }
+
+ # tries to get rid of ugly directory structure
+ file { "/srv/gitolite":
+ ensure => absent,
+ force => true,
+ backup => false,
+ require => User["gitolite"],
+ }
+
+ # we also don't need /var/gitolite
+ file { "/var/lib/gitolite":
+ ensure => absent,
+ force => true,
+ backup => false,
+ require => User["gitolite"],
+ }
+
+ # mass update script
+ file { "/usr/local/sbin/git-mass-update-server-info":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0755,
+ source => "puppet:///modules/git/git-mass-update-server-info",
+ }
+
+ # mass update hourly
+ cron { "/usr/local/sbin/git-mass-update-server-info":
+ command => "/usr/local/sbin/git-mass-update-server-info &> /dev/null",
+ user => root,
+ hour => "*/1",
+ minute => "20",
+ ensure => present,
+ require => File['/usr/local/sbin/git-mass-update-server-info'],
+ }
+}
+
diff --git a/manifests/init.pp b/manifests/init.pp
index 8a7b270..9e1a5f6 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -4,3 +4,4 @@ import "git.pp"
import "gitosis.pp"
import "gitweb.pp"
import "git-daemon.pp"
+import "gitolite.pp"