diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-19 16:05:49 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-19 16:05:49 -0200 |
commit | fc6433630e29e2d4ea940324c71a78e12d0def3c (patch) | |
tree | 27cac6b9eb6d05331b89f238669c708675bc8688 | |
parent | ce6ab8ffe205dfc0fb9fef828b3f13f36b67fa18 (diff) | |
download | puppet-ikiwiki-fc6433630e29e2d4ea940324c71a78e12d0def3c.tar.gz puppet-ikiwiki-fc6433630e29e2d4ea940324c71a78e12d0def3c.tar.bz2 |
Upgrading for 2.7 compatibility
-rw-r--r-- | manifests/init.pp | 89 | ||||
-rw-r--r-- | manifests/instance.pp | 81 | ||||
-rw-r--r-- | templates/deploy.sh.erb | 2 | ||||
-rw-r--r-- | templates/ikiwiki.setup.erb | 6 | ||||
-rw-r--r-- | templates/refresh.sh.erb | 2 |
5 files changed, 89 insertions, 91 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index e3972bd..061ee2e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,12 +1,10 @@ -class ikiwiki { +class ikiwiki( + $sites_folder = ${apache::sites_folder) +) { package { [ "ikiwiki", "po4a" ]: ensure => installed, } - case $apache_sites_folder { - '': { fail("you need to define \$apache_sites_folder for ikiwiki module") } - } - file { "/usr/local/sbin/ikiwiki-deploy": ensure => present, content => template('ikiwiki/deploy.sh.erb'), @@ -23,85 +21,4 @@ class ikiwiki { mode => 755, } - define instance($base_url = $domain, $ensure = 'present', $description = false, - $adminuser = 'yourname', $adminemail = 'me@example.org', $instance = 'ikiwiki', - $account_creation_password = false, $add_plugins = false, $disable_plugins = false, - $protocol = 'https') { - - $desc = $description ? { - false => $title, - default => $description, - } - - case $ensure { - 'present': { - file { "/etc/ikiwiki/$name.setup": - ensure => present, - content => template('ikiwiki/ikiwiki.setup.erb'), - owner => www-data, - group => www-data, - mode => 640, - notify => Exec["ikiwiki_refresh_${name}"], - } - - exec { "ikiwiki_refresh_${name}": - command => "/usr/local/sbin/ikiwiki-refresh $name $instance", - user => root, - refreshonly => true, - } - - if !defined(File["${apache_sites_folder}/${name}/${instance}_src"]) { - file { "${apache_sites_folder}/${name}/${instance}_src": - ensure => directory, - owner => www-data, - group => www-data, - recurse => true, - notify => Exec["ikiwiki_refresh_${name}"], - require => File["${apache_sites_folder}/${name}"], - } - } - - if !defined(File["${apache_sites_folder}/${name}/${instance}"]) { - file { "${apache_sites_folder}/${name}/${instance}": - ensure => directory, - owner => www-data, - group => www-data, - recurse => true, - require => File["${apache_sites_folder}/${name}"], - } - } - - if !defined(File["${apache_sites_folder}/${name}"]) { - file { "${apache_sites_folder}/${name}": - ensure => directory, - owner => root, - group => root, - } - } - - # The post-update hook should have www-data as owner so - # gitolite can do a setuid to it and write to ikiwiki - # folders without messing the permission scheme. - # - # The same is valid for the cgi. - # - # See http://ikiwiki.info/rcs/git/ - # http://ikiwiki.info/forum/multi-user_setup_of_ikiwiki__44___gitolite_and_apache2_in_Debian_Sid/ - # - file { [ "/var/git/repositories/${name}.git/hooks/post-update", - "${apache_sites_folder}/${name}/${instance}/ikiwiki.cgi" ]: - ensure => present, - owner => www-data, - group => gitolite, - mode => 6550, - require => File["/etc/ikiwiki/$name.setup"], - } - } - 'absent': { - file { "/etc/ikiwiki/$name.setup": - ensure => absent, - } - } - } - } } diff --git a/manifests/instance.pp b/manifests/instance.pp new file mode 100644 index 0000000..3c76365 --- /dev/null +++ b/manifests/instance.pp @@ -0,0 +1,81 @@ +define ikiwiki::instance($base_url = $domain, $ensure = 'present', $description = false, + $adminuser = 'yourname', $adminemail = 'me@example.org', $instance = 'ikiwiki', + $account_creation_password = false, $add_plugins = false, $disable_plugins = false, + $protocol = 'https') { + + $desc = $description ? { + false => $title, + default => $description, + } + + case $ensure { + 'present': { + file { "/etc/ikiwiki/$name.setup": + ensure => present, + content => template('ikiwiki/ikiwiki.setup.erb'), + owner => www-data, + group => www-data, + mode => 640, + notify => Exec["ikiwiki_refresh_${name}"], + } + + exec { "ikiwiki_refresh_${name}": + command => "/usr/local/sbin/ikiwiki-refresh $name $instance", + user => root, + refreshonly => true, + } + + if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}_src"]) { + file { "${ikiwiki::sites_folder}/${name}/${instance}_src": + ensure => directory, + owner => www-data, + group => www-data, + recurse => true, + notify => Exec["ikiwiki_refresh_${name}"], + require => File["${ikiwiki::sites_folder}/${name}"], + } + } + + if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}"]) { + file { "${ikiwiki::sites_folder}/${name}/${instance}": + ensure => directory, + owner => www-data, + group => www-data, + recurse => true, + require => File["${ikiwiki::sites_folder}/${name}"], + } + } + + if !defined(File["${ikiwiki::sites_folder}/${name}"]) { + file { "${ikiwiki::sites_folder}/${name}": + ensure => directory, + owner => root, + group => root, + } + } + + # The post-update hook should have www-data as owner so + # gitolite can do a setuid to it and write to ikiwiki + # folders without messing the permission scheme. + # + # The same is valid for the cgi. + # + # See http://ikiwiki.info/rcs/git/ + # http://ikiwiki.info/forum/multi-user_setup_of_ikiwiki__44___gitolite_and_apache2_in_Debian_Sid/ + # + file { [ "/var/git/repositories/${name}.git/hooks/post-update", + "${ikiwiki::sites_folder}/${name}/${instance}/ikiwiki.cgi" ]: + ensure => present, + owner => www-data, + group => gitolite, + mode => 6550, + require => File["/etc/ikiwiki/$name.setup"], + } + } + 'absent': { + file { "/etc/ikiwiki/$name.setup": + ensure => absent, + } + } + } +} diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb index e5bfa92..4bbfb43 100644 --- a/templates/deploy.sh.erb +++ b/templates/deploy.sh.erb @@ -2,7 +2,7 @@ NAME="$1" INSTANCE="$2" -BASE="<%= apache_sites_folder %>" +BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>" SITE=$BASE/$NAME CONF="/etc/ikiwiki" WEB_OWNER="www-data" diff --git a/templates/ikiwiki.setup.erb b/templates/ikiwiki.setup.erb index 56d5ad2..1c90988 100644 --- a/templates/ikiwiki.setup.erb +++ b/templates/ikiwiki.setup.erb @@ -11,8 +11,8 @@ use IkiWiki::Setup::Standard { adminemail => '<%= adminemail %>', # Be sure to customise these.. - srcdir => "<%= apache_sites_folder %>/<%= name %>/ikiwiki_src", - destdir => "<%= apache_sites_folder %>/<%= name %>/ikiwiki", + srcdir => "<%= scope.lookupvar('ikiwiki::sites_folder') %>/<%= name %>/ikiwiki_src", + destdir => "<%= scope.lookupvar('ikiwiki::sites_folder') %>/<%= name %>/ikiwiki", url => "<%= protocol %>://<%= name %>.<%= base_url %>", cgiurl => "<%= protocol %>://<%= name %>.<%= base_url %>/ikiwiki.cgi", @@ -63,7 +63,7 @@ use IkiWiki::Setup::Standard { { # The cgi wrapper. cgi => 1, - wrapper => "<%= apache_sites_folder %>/<%= name %>/ikiwiki/ikiwiki.cgi", + wrapper => "<%= scope.lookupvar('ikiwiki::sites_folder') %>/<%= name %>/ikiwiki/ikiwiki.cgi", wrappermode => "06550", wrappergroup => "gitosis", }, diff --git a/templates/refresh.sh.erb b/templates/refresh.sh.erb index 6680f23..0b2b796 100644 --- a/templates/refresh.sh.erb +++ b/templates/refresh.sh.erb @@ -2,7 +2,7 @@ NAME="$1" INSTANCE="$2" -BASE="<%= apache_sites_folder %>" +BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>" SITE=$BASE/$NAME CONF="/etc/ikiwiki" WEB_OWNER="www-data" |