Created
May 3, 2013 14:53
-
-
Save ojacobson/5509601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class gitolite { | |
group { 'git': | |
ensure => present, | |
system => true, | |
} | |
user { 'git': | |
ensure => present, | |
system => true, | |
gid => git, | |
home => '/var/lib/gitolite3', | |
shell => '/bin/bash', | |
password => '*', | |
comment => 'git repository hosting,,,', | |
} | |
git::clone { 'git://github.com/sitaramc/gitolite': | |
creates => '/opt/gitolite', | |
} | |
exec { '/opt/gitolite/install': | |
command => '/opt/gitolite/install -ln /usr/local/bin', | |
path => '/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin', | |
user => root, | |
group => root, | |
creates => '/usr/local/bin/gitolite', | |
require => Git::Clone['git://github.com/sitaramc/gitolite'], | |
} | |
File { | |
owner => git, | |
group => git, | |
require => User['git'], | |
} | |
file { '/var/lib/gitolite3': | |
ensure => directory, | |
mode => 0644, | |
} | |
file { '/var/lib/gitolite3/admin.pub': | |
ensure => file, | |
mode => 0644, | |
source => 'puppet:///modules/gitolite/admin.pub', | |
notify => Exec['gitolite setup'], | |
} | |
file { '/var/lib/gitolite3/.gitolite.rc': | |
ensure => file, | |
mode => 0644, | |
source => 'puppet:///modules/gitolite/gitolite.rc', | |
notify => Exec['gitolite setup'], | |
} | |
exec { 'gitolite setup': | |
# Aww, man, no umask param? http://projects.puppetlabs.com/issues/4424 | |
# The naive solution (without bash -c and quoting hell) gives | |
# err: […]/Exec[gitolite setup]: Failed to call refresh: Could not find command 'umask' | |
command => "bash -c 'umask 0027 && gitolite setup --pubkey admin.pub'", | |
path => '/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin', | |
environment => [ | |
'HOME=/var/lib/gitolite3', | |
'USER=git', | |
], | |
user => git, | |
group => git, | |
cwd => '/var/lib/gitolite3', | |
refreshonly => true, | |
require => Exec['/opt/gitolite/install'], | |
} | |
file { '/var/lib/gitolite3/repositories/gitolite-admin.git/description': | |
ensure => absent, | |
require => Exec['gitolite setup'], | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName <%= hostname %> | |
DocumentRoot /usr/share/gitweb | |
<Directory /usr/share/gitweb> | |
Options FollowSymLinks +ExecCGI | |
AddHandler cgi-script .cgi | |
</Directory> | |
<Location /> | |
AuthType Basic | |
AuthName <%= auth_realm %> | |
AuthBasicProvider ldap | |
AuthLDAPURL <%= ldap_url %> | |
AuthLDAPBindDN <%= ldap_bind_dn %> | |
AuthLDAPBindPassword <%= ldap_bind_passwd %> | |
Require valid-user | |
</Location> | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# path to git projects (<project>.git) | |
$projectroot = "<%= project_root %>"; | |
# directory to use for temp files | |
$git_temp = "/tmp"; | |
# target of the home link on top of all pages | |
#$home_link = $my_uri || "/"; | |
# html text to include at home page | |
#$home_text = "indextext.html"; | |
# file with project list; by default, simply scan the projectroot dir. | |
$projects_list = "<%= project_list %>"; | |
# stylesheet to use | |
#@stylesheets = ("static/gitweb.css"); | |
# javascript code for gitweb | |
#$javascript = "static/gitweb.js"; | |
# logo to use | |
#$logo = "static/git-logo.png"; | |
# the 'favicon' | |
#$favicon = "static/git-favicon.png"; | |
# git-diff-tree(1) options to use for generated patches | |
#@diff_opts = ("-M"); | |
@diff_opts = (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class gitweb( | |
$hostname, | |
$project_root, | |
$project_list, | |
$auth_realm, | |
$ldap_url, | |
$ldap_bind_dn, | |
$ldap_bind_passwd | |
) { | |
package { 'gitweb': | |
ensure => installed, | |
} | |
# Remove the default config, which affects every vhost (what). | |
file { '/etc/apache2/conf.d/gitweb': | |
ensure => absent, | |
notify => Service['apache2'], | |
require => Package['gitweb'], | |
} | |
file { '/etc/gitweb.conf': | |
ensure => file, | |
owner => root, | |
group => root, | |
mode => 0444, | |
content => template('gitweb/gitweb.conf.erb'), | |
require => Package['gitweb'], | |
} | |
apache2::site { $hostname: | |
config => template('gitweb/apache.conf.erb'), | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
user { 'www-data': | |
groups => ['git'], | |
system => true, | |
require => Package['apache2'], | |
notify => Service['apache2'], | |
} | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment