]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Upgrading websites for initial 2.7 compatibility
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Jan 2013 18:10:30 +0000 (16:10 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Jan 2013 18:10:30 +0000 (16:10 -0200)
manifests/subsystems/websites.pp

index 7c67b4a05a30e666dd16bdceba7dd9321763a1eb..52886fc457b2b0a44de53224dfc3e604adb4793a 100644 (file)
@@ -1,19 +1,9 @@
 class websites::setup {
-  # Configure Apache Web Server
-  $apache_www_folder   = "/var/www/data"
-  $apache_error_folder = "/var/www/error"
-  $apache_sites_folder = "/var/sites"
-  $apache_error_dest   = "http://${domain}/missing.html"
-  $drupal_folder       = "${apache_www_folder}/drupal"
-  $viewvc_root_parents = "/var/svn : svn"
-
-  $default_vhost = $apache_server_name ? {
-    ''      => $hostname,
-    default => $apache_server_name,
-  }
-
   # Include apache
-  include apache
+  # TODO: find a better way to pass parameters
+  class { 'apache':
+    https_proxy => $apache_https_proxy,
+  }
 
   # The needed apache modules
   apache::module { "alias":
@@ -21,7 +11,7 @@ class websites::setup {
   }
 
   # Images folder
-  file { "${apache_www_folder}/images":
+  file { "${apache::www_folder}/images":
     ensure  => directory,
     recurse => true,
     purge   => true,
@@ -31,27 +21,27 @@ class websites::setup {
     # This mode will also apply to files from the source directory
     mode    => 0644,
     # Puppet will automatically set +x for directories
-    source  => [ "puppet:///modules/site-apache/htdocs/$domain/images",
+    source  => [ "puppet:///modules/site_apache/htdocs/$domain/images",
                  "puppet:///modules/nodo/htdocs/images", ]
   }
 
   # Web index
-  file { "${apache_www_folder}/index.html":
+  file { "${apache::www_folder}/index.html":
     ensure  => present,
     owner   => "root",
     group   => "root",
     mode    => 0644,
-    source  => [ "puppet:///modules/site-apache/htdocs/$domain/index.html",
+    source  => [ "puppet:///modules/site_apache/htdocs/$domain/index.html",
                  "puppet:///modules/nodo/htdocs/index.html", ]
   }
 
   # Missing page
-  file { "${apache_www_folder}/missing.html":
+  file { "${apache::www_folder}/missing.html":
     ensure  => present,
     owner   => "root",
     group   => "root",
     mode    => 0644,
-    source  => [ "puppet:///modules/site-apache/htdocs/$domain/missing.html",
+    source  => [ "puppet:///modules/site_apache/htdocs/$domain/missing.html",
                  "puppet:///modules/nodo/htdocs/missing.html", ]
   }
 
@@ -61,9 +51,9 @@ class websites::setup {
   }
 
   # Default vhost: can just be applied on the defining host
-  apache::site { "$default_vhost":
+  apache::site { "${apache::server_name}":
     server_alias => "$domain",
-    docroot      => "${apache_www_folder}",
+    docroot      => "${apache::www_folder}",
     mpm          => false,
     tag          => 'all',
   }
@@ -71,81 +61,55 @@ class websites::setup {
   # We have to use 'zzz-error' so it will be the last matched vhost
   apache::site { "error":
     template       => 'apache/error.erb',
-    docroot        => "${apache_error_folder}",
+    docroot        => "${apache::error_folder}",
     filename       => 'zzz-error',
     mpm            => false,
     tag            => 'all',
   }
 
   # Index page for error
-  file { "${apache_error_folder}/index.html":
-    ensure  => "${apache_www_folder}/index.html",
+  file { "${apache::error_folder}/index.html":
+    ensure  => "${apache::www_folder}/index.html",
     owner   => "root",
     group   => "root",
     force   => true,
-    require => File["$apache_error_folder"],
+    require => File["${apache::error_folder}"],
   }
 
   # Images folder for error
-  file { "${apache_error_folder}/images":
-    ensure  => "${apache_www_folder}/images",
-    owner   => "root",
-    group   => "root",
-    force   => true,
-    require => File["$apache_error_folder", "${apache_www_folder}/images"],
-  }
-
-  # TODO: this is temporary: remove when all nodes have applied it
-  # We have to use 'zzz-erro' so it will be the last matched vhost
-  apache::site { "erro":
-    ensure         => absent,
-    docroot        => '/var/www/erro',
-    filename       => 'zzz-erro',
-    tag            => 'all',
-  }
-
-  # TODO: this is temporary: remove when all nodes have applied it
-  file { "/var/www/erro":
-    ensure  => absent,
-    recurse => true,
-    force   => true,
-  }
-
-  # TODO: this is temporary: remove when all nodes have applied it
-  # Index page for erro
-  file { "/var/www/erro/index.html":
-    ensure  => absent,
+  file { "${apache::error_folder}/images":
+    ensure  => "${apache::www_folder}/images",
     owner   => "root",
     group   => "root",
     force   => true,
+    require => File["${apache::error_folder}", "${apache::www_folder}/images"],
   }
 
-  # TODO: this is temporary: remove when all nodes have applied it
-  file { "/var/www/erro/missing.html":
-    ensure  => absent,
-  }
 }
 
 class websites::hosting inherits websites::setup {
   # Include the needed classes for website hosting
   include php
-  include drupal
   include trac
   include websvn
-  include viewvc
   include moin
-  include ikiwiki
-  include pmwiki
   include apache::rails
-  include wordpress
-  include hotglue
+
+  # Declare the needed classes for website hosting 
+  class { [ 'drupal', 'ikiwiki', 'pmwiki', 'hotglue' ]: }
+  class {
+    'viewvc':
+      $root_parents => "/var/svn : svn";
+    'wordpress':
+      locale => $::wordpress_locale;
+  }
 
   if $git_daemon != false {
     include gitweb
   }
 
   apache::site { "images":
-    docroot => "${apache_www_folder}/images",
+    docroot => "${apache::www_folder}/images",
     mpm     => false,
     tag     => 'all',
   }
@@ -175,6 +139,8 @@ class websites::hosting::admin inherits websites::setup {
 class websites::dev::setup inherits websites::setup {
   # Include the needed classes for website development
   include php
-  include drupal
   include apache::rails
+
+  # Declare the needed classes for website development
+  class { 'drupal': }
 }