diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/clone.pp | 85 | ||||
-rw-r--r-- | manifests/web.pp | 6 | ||||
-rw-r--r-- | manifests/web/lighttpd.pp | 21 | ||||
-rw-r--r-- | manifests/web/repo.pp | 7 | ||||
-rw-r--r-- | manifests/web/repo/lighttpd.pp | 36 |
5 files changed, 74 insertions, 81 deletions
diff --git a/manifests/clone.pp b/manifests/clone.pp index 1d6a298..29f0b2b 100644 --- a/manifests/clone.pp +++ b/manifests/clone.pp @@ -1,37 +1,60 @@ +# submodules: Whether we should initialize and update +# submodules as well +# Default: false +# clone_before: before which resources a cloning should +# happen. This is releveant in combination +# with submodules as the exec of submodules +# requires the `cwd` and you might get a +# dependency cycle if you manage $projectroot +# somewhere else. define git::clone( - $ensure = present, - $git_repo, - $projectroot, - $cloneddir_user='root', - $cloneddir_group='0', - $cloneddir_restrict_mode=true + $ensure = present, + $git_repo, + $projectroot, + $submodules = false, + $clone_before = 'absent', + $cloneddir_user='root', + $cloneddir_group='0', + $cloneddir_restrict_mode=true ){ - case $ensure { - absent: { - exec{"rm -rf $projectroot": - onlyif => "test -d $projectroot", - } + case $ensure { + absent: { + exec{"rm -rf $projectroot": + onlyif => "test -d $projectroot", + } + } + default: { + require ::git + exec {"git-clone_${name}": + command => "git clone --no-hardlinks ${git_repo} ${projectroot}", + creates => "${projectroot}/.git", + user => root, + notify => Exec["git-clone-chown_${name}"], + } + if $clone_before != 'absent' { + Exec["git-clone_${name}"]{ + before => $clone_before, + } + } + if $submodules { + exec{"git-submodules_${name}": + command => "git submodule init && git submodule update", + cwd => $projectroot, + refreshonly => true, + subscribe => Exec["git-clone_${name}"], } - default: { - include git - exec {"git-clone_${name}": - command => "git-clone --no-hardlinks ${git_repo} ${projectroot}", - creates => "${projectroot}/.git", - user => root, - require => Package['git'], - notify => Exec["git-clone-chown_${name}"], - } - exec {"git-clone-chown_${name}": - command => "chown -R ${cloneddir_user}:${cloneddir_group} ${projectroot};chmod -R og-rwx ${projectroot}/.git", - refreshonly => true - } - if $cloneddir_restrict_mode { - exec {"git-clone-chmod_${name}": - command => "chmod -R o-rwx ${projectroot}", - refreshonly => true, - subscribe => Exec["git-clone_${name}"], - } - } + } + exec {"git-clone-chown_${name}": + command => "chown -R ${cloneddir_user}:${cloneddir_group} ${projectroot};chmod -R og-rwx ${projectroot}/.git", + refreshonly => true + } + if $cloneddir_restrict_mode { + exec {"git-clone-chmod_${name}": + command => "chmod -R o-rwx ${projectroot}", + refreshonly => true, + subscribe => Exec["git-clone_${name}"], } + } } + } } diff --git a/manifests/web.pp b/manifests/web.pp index f82e8d3..73ed8f6 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -10,9 +10,9 @@ class git::web { owner => root, group => 0, mode => 0755; } file{'/etc/gitweb.conf': - source => [ "puppet://$server/modules/site-git/web/${fqdn}/gitweb.conf", - "puppet://$server/modules/site-git/web/gitweb.conf", - "puppet://$server/modules/git/web/gitweb.conf" ], + source => [ "puppet:///modules/site-git/web/${fqdn}/gitweb.conf", + "puppet:///modules/site-git/web/gitweb.conf", + "puppet:///modules/git/web/gitweb.conf" ], require => Package['gitweb'], owner => root, group => 0, mode => 0644; } diff --git a/manifests/web/lighttpd.pp b/manifests/web/lighttpd.pp index a169dc9..9534c60 100644 --- a/manifests/web/lighttpd.pp +++ b/manifests/web/lighttpd.pp @@ -1,24 +1,7 @@ class git::web::lighttpd { include ::lighttpd - include lighttpd::base::git::web - file{'/etc/lighttpd/lighttpd-gitweb.conf': - ensure => present, - require => Package['lighttpd'], - notify => Service['lighttpd'], - owner => root, group => 0, mode => 0644; - } - - file{'/etc/lighttpd/gitweb.d': - ensure => directory, - require => Package['lighttpd'], - owner => root, group => 0, mode => 0755; - } -} -class lighttpd::base::git::web inherits lighttpd::base { - File['/etc/lighttpd/lighttpd.conf']{ - source => [ "puppet://$server/modules/site-git/web/${fqdn}/lighttpd.conf", - "puppet://$server/modules/site-git/web/lighttpd.conf", - "puppet://$server/modules/git/web/lighttpd.conf" ], + lighttpd::config::file{'lighttpd-gitweb': + content => 'global { server.modules += ("mod_rewrite", "mod_redirect", "mod_alias", "mod_setenv", "mod_cgi" ) }', } } diff --git a/manifests/web/repo.pp b/manifests/web/repo.pp index 2cb387a..da6f74f 100644 --- a/manifests/web/repo.pp +++ b/manifests/web/repo.pp @@ -1,10 +1,15 @@ # domain: the domain under which this repo will be avaiable # projectroot: where the git repos are listened # projects_list: which repos to export +# +# logmode: +# - default: Do normal logging including ips +# - anonym: Don't log ips define git::web::repo( $ensure = 'present', $projectroot = 'absent', $projects_list = 'absent', + $logmode = 'default', $sitename = 'absent' ){ if ($ensure == 'present') and (($projects_list == 'absent') or ($projectroot == 'absent')){ @@ -31,12 +36,14 @@ define git::web::repo( 'lighttpd': { git::web::repo::lighttpd{$name: ensure => $ensure, + logmode => $logmode, gitweb_url => $gitweb_url, gitweb_config => $gitweb_config, } } 'apache': { apache::vhost::gitweb{$gitweb_url: + logmode => $logmode, ensure => $ensure, } } diff --git a/manifests/web/repo/lighttpd.pp b/manifests/web/repo/lighttpd.pp index 6676c4d..11cee4c 100644 --- a/manifests/web/repo/lighttpd.pp +++ b/manifests/web/repo/lighttpd.pp @@ -1,36 +1,16 @@ +# logmode: +# - default: Do normal logging including ips +# - anonym: Don't log ips define git::web::repo::lighttpd( $ensure = 'present', $gitweb_url, + $logmode = 'default', $gitweb_config ){ if $ensure == 'present' { include git::web::lighttpd } - file{"/etc/lighttpd/gitweb.d/${name}.conf": } - if $ensure == 'present' { - File["/etc/lighttpd/gitweb.d/${name}.conf"]{ - content => template("git/web/lighttpd"), - owner => root, group => 0, mode => 0644 - } - } else { - File["/etc/lighttpd/gitweb.d/${name}.conf"]{ - ensure => $ensure, - } - } - line{"include_of_gitwebrepo_${name}": - ensure => $ensure, - line => "include \"gitweb.d/${name}.conf\"", - file => "/etc/lighttpd/lighttpd-gitweb.conf", - } - if defined(Service['lighttpd']) { - File["/etc/lighttpd/gitweb.d/${name}.conf"]{ - notify => Service['lighttpd'], - } - Line["include_of_gitwebrepo_${name}"]{ - notify => Service['lighttpd'], - } - } - if defined(File['/etc/lighttpd/lighttpd-gitweb.conf']){ - Line["include_of_gitwebrepo_${name}"]{ - require => File['/etc/lighttpd/lighttpd-gitweb.conf'], - } + + lighttpd::vhost::file{$name: + ensure => $ensure, + content => template('git/web/lighttpd'); } } |