From 2ead031c3e15ad1aeee4113be3250a74fa4bc766 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 25 Jan 2013 10:40:42 -0200 Subject: Refactoring to use parametrized classes and hiera --- manifests/daemon.pp | 29 +++++++++++++++++++++++++++++ manifests/git-daemon.pp | 17 ----------------- manifests/git-manager.pp | 14 -------------- manifests/gitweb.pp | 17 ++++++----------- manifests/init.pp | 3 +-- 5 files changed, 36 insertions(+), 44 deletions(-) create mode 100644 manifests/daemon.pp delete mode 100644 manifests/git-daemon.pp delete mode 100644 manifests/git-manager.pp (limited to 'manifests') diff --git a/manifests/daemon.pp b/manifests/daemon.pp new file mode 100644 index 0000000..546aae9 --- /dev/null +++ b/manifests/daemon.pp @@ -0,0 +1,29 @@ +# This class configures the git-daemon service. It ensures the packages is +# installed and a line is present in /etc/inetd.conf, which configures it. +# It depends on a "line" definition, which can be found here: +# +# http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText + +class git::daemon ( + $implementation = hiera('git::daemon::implementation', 'gitolite') +) { + + case $implementation { + 'gitosis': { + include gitosis + } + default: { + include gitolite + } + } + + # the needed packages and services + include inetd + + # git-daemon config in inetd + line { "git-daemon-inetd": + file => "/etc/inetd.conf", + line => "git stream tcp nowait ${implementation} /usr/bin/git git daemon --inetd --verbose --base-path=/var/git/repositories /var/git/repositories", + ensure => present, + } +} diff --git a/manifests/git-daemon.pp b/manifests/git-daemon.pp deleted file mode 100644 index 5a5e4fb..0000000 --- a/manifests/git-daemon.pp +++ /dev/null @@ -1,17 +0,0 @@ -# This class configures the git-daemon service. It ensures the packages is -# installed and a line is present in /etc/inetd.conf, which configures it. -# It depends on a "line" definition, which can be found here: -# -# http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText - -class git-daemon inherits git-manager { - # the needed packages and services - include inetd - - # git-daemon config in inetd - line { "git-daemon-inetd": - file => "/etc/inetd.conf", - line => "git stream tcp nowait $git_server_implementation /usr/bin/git git daemon --inetd --verbose --base-path=/var/git/repositories /var/git/repositories", - ensure => present, - } -} diff --git a/manifests/git-manager.pp b/manifests/git-manager.pp deleted file mode 100644 index 52e546b..0000000 --- a/manifests/git-manager.pp +++ /dev/null @@ -1,14 +0,0 @@ -class git-manager { - case $git_server_implementation { - '': { $git_server_implementation = 'gitolite' } - } - - case $git_server_implementation { - 'gitosis': { - include gitosis - } - default: { - include gitolite - } - } -} diff --git a/manifests/gitweb.pp b/manifests/gitweb.pp index 045787d..1305390 100644 --- a/manifests/gitweb.pp +++ b/manifests/gitweb.pp @@ -1,19 +1,14 @@ # This class handles a gitweb installation. -class gitweb inherits git-manager { +class gitweb( + $protocol = hiera('git::web::protocol', 'git'), + $hosting_domain = hiera('git::web::hosting_domain', $::domain) + $implementation = hiera('git::daemon::implementation', 'gitolite') +) { + # the needed packages package { gitweb: ensure => installed } - $hosting_domain = $base_domain ? { - '' => $domain, - default => $base_domain, - } - - $base_url_protocol = $gitweb_protocol ? { - '' => 'git', - default => $gitweb_protocol, - } - # gitweb config file file { "/etc/gitweb.conf": owner => "root", diff --git a/manifests/init.pp b/manifests/init.pp index 09e9010..e3bd908 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,6 +3,5 @@ import "git.pp" import "gitosis.pp" import "gitweb.pp" -import "git-daemon.pp" -import "git-manager.pp" +import "daemon.pp" import "gitolite.pp" -- cgit v1.2.3