aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-02-07 15:35:34 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-02-07 15:35:34 -0200
commit3994db56dd89d90e216712491956bb2b22382ff8 (patch)
tree612066761cc24c04320bb18fcca2106a224fa37e
parent6a5a4ca4c9ab0eae983bbab0a4e4cf10653da76e (diff)
downloadpuppet-nodo-3994db56dd89d90e216712491956bb2b22382ff8.tar.gz
puppet-nodo-3994db56dd89d90e216712491956bb2b22382ff8.tar.bz2
Adding websites' classes and enhancing nodo::master
-rw-r--r--manifests/init.pp12
-rw-r--r--manifests/websites.pp92
2 files changed, 103 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 36c7413..8618042 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -12,6 +12,7 @@ import "sysctl.pp"
import "ups.pp"
import "utils.pp"
import "database.pp"
+import "websites.pp"
class nodo {
include lsb
@@ -379,7 +380,7 @@ class nodo::master {
include nodo::vserver
include database
include gitosis
- include trac
+ include websites::admin
# TODO:
#include munin::host
@@ -389,6 +390,15 @@ class nodo::master {
alias => ["puppet.$domain"],
}
+ case $puppetmaster_db_password {
+ '': { fail("Please set \$puppetmaster_db_password in your host config") }
+ }
+
+ # update master's puppet.conf if you change here
+ database::instance { "puppet":
+ password => "$puppetmaster_db_password",
+ }
+
backupninja::mysql { "all_databases":
backupdir => '/var/backups/mysql',
compress => true,
diff --git a/manifests/websites.pp b/manifests/websites.pp
new file mode 100644
index 0000000..34475dd
--- /dev/null
+++ b/manifests/websites.pp
@@ -0,0 +1,92 @@
+class websites::setup {
+ # Configure Apache Web Server
+ $apache_www_folder = "/var/www/data"
+ $apache_sites_folder = "/var/sites"
+ $apache_error_dest = "http://${domain}/missing.html"
+ $drupal_folder = "${apache_www_folder}/drupal"
+
+ # Include apache
+ include apache
+
+ # The needed apache modules
+ apache::module { "rewrite":
+ ensure => present,
+ }
+
+ # Images folder
+ file { "${apache_www_folder}/images":
+ ensure => directory,
+ recurse => true,
+ purge => true,
+ force => true,
+ owner => "root",
+ group => "root",
+ # This mode will also apply to files from the source directory
+ mode => 0644,
+ # Puppet will automatically set +x for directories
+ source => "puppet://$server/files/apache/htdocs/images",
+ }
+
+ # Web index
+ file { "${apache_www_folder}/index.html":
+ ensure => present,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ source => "puppet://$server/files/apache/htdocs/index.html",
+ }
+
+ # Missing page
+ file { "${apache_www_folder}/missing.html":
+ ensure => present,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ source => "puppet://$server/files/apache/htdocs/missing.html",
+ }
+
+ # Default vhost: can just be applied on the defining host
+ apache::site { "$hostname":
+ server_alias => "$domain",
+ docroot => "${apache_www_folder}",
+ }
+
+ # We have to use 'zzz-erro' so it will be the last matched vhost
+ apache::site { "erro":
+ source => true,
+ docroot => '/var/www/erro',
+ filename => 'zzz-erro',
+ }
+
+ # Index page for erro
+ file { "/var/www/erro/index.html":
+ ensure => "${apache_www_folder}/index.html",
+ owner => "root",
+ group => "root",
+ force => true,
+ require => File["/var/www/erro"],
+ }
+
+ # TODO: this is temporary: remove when all nodes have applied it
+ file { "/var/www/erro/missing.html":
+ ensure => absent,
+ require => File["/var/www/erro"],
+ }
+}
+
+class websites::hosting inherits websites::setup {
+ # Include the needed classes for website hosting
+ include drupal
+ include gitweb
+ include trac
+ include websvn
+ include moin
+ include ikiwiki
+ include pmwiki
+}
+
+class websites::admin inherits websites::setup {
+ # Include the needed classes for admin interfaces
+ include trac
+ include gitweb
+}