summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-04-12 17:12:53 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-04-12 17:12:53 -0300
commitff9357ff1bf4682163e283620fe8e596387de713 (patch)
tree4c8325ca1fdd2a18044fb47a48003f313999bc40 /manifests
downloadpuppet-websites-ff9357ff1bf4682163e283620fe8e596387de713.tar.gz
puppet-websites-ff9357ff1bf4682163e283620fe8e596387de713.tar.bz2
Initial import
Diffstat (limited to 'manifests')
-rw-r--r--manifests/dev/setup.pp8
-rw-r--r--manifests/hosting.pp42
-rw-r--r--manifests/hosting/admin.pp5
-rw-r--r--manifests/init.pp1
-rw-r--r--manifests/setup.pp93
5 files changed, 149 insertions, 0 deletions
diff --git a/manifests/dev/setup.pp b/manifests/dev/setup.pp
new file mode 100644
index 0000000..12524e2
--- /dev/null
+++ b/manifests/dev/setup.pp
@@ -0,0 +1,8 @@
+class websites::dev::setup inherits websites::setup {
+ # Include the needed classes for website development
+ include php
+ include apache::rails
+
+ # Declare the needed classes for website development
+ class { 'drupal': }
+}
diff --git a/manifests/hosting.pp b/manifests/hosting.pp
new file mode 100644
index 0000000..309e840
--- /dev/null
+++ b/manifests/hosting.pp
@@ -0,0 +1,42 @@
+class websites::hosting inherits websites::setup {
+ # Include the needed classes for website hosting
+ include php
+ include trac
+ include websvn
+ include moin
+ include apache::rails
+
+ # Declare the needed classes for website hosting
+ class { [ 'drupal', 'ikiwiki', 'pmwiki', 'hotglue', 'wordpress' ]: }
+ class {
+ 'viewvc':
+ root_parents => "/var/svn : svn";
+ }
+
+ $git_daemon = hiera('nodo::web::git_daemon', True)
+
+ if $git_daemon != false {
+ class { 'gitweb': }
+ }
+
+ apache::site { "images":
+ docroot => "${apache::www_folder}/images",
+ mpm => false,
+ tag => 'all',
+ }
+
+ # Remove untagged site instances
+ Apache::Site <| tag != $::hostname and tag != 'all' |> {
+ ensure => absent,
+ }
+
+ # Remove untagged database instances
+ Database::Instance <| tag != $::hostname and tag != 'all' |> {
+ ensure => absent,
+ }
+
+ # Remove untagged ikiwiki instances
+ Ikiwiki::Instance <| tag != $::hostname and tag != 'all' |> {
+ ensure => absent,
+ }
+}
diff --git a/manifests/hosting/admin.pp b/manifests/hosting/admin.pp
new file mode 100644
index 0000000..554a202
--- /dev/null
+++ b/manifests/hosting/admin.pp
@@ -0,0 +1,5 @@
+class websites::hosting::admin inherits websites::setup {
+ # Include the needed classes for admin interfaces
+ include trac
+ include gitweb
+}
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..8f8b440
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1 @@
+# Websites module
diff --git a/manifests/setup.pp b/manifests/setup.pp
new file mode 100644
index 0000000..af2bce6
--- /dev/null
+++ b/manifests/setup.pp
@@ -0,0 +1,93 @@
+class websites::setup {
+ # Third-party hosted nodes generally aren't behind an https proxy
+ $hosting_type = hiera('nodo::vserver::hosting_type', 'direct')
+
+ # Include apache
+ class { 'apache':
+ https_proxy => $hosting_type ? {
+ 'direct' => 'yes',
+ default => false,
+ },
+ }
+
+ # The needed apache modules
+ apache::module { "alias":
+ 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:///modules/site_apache/htdocs/${::domain}/images",
+ "puppet:///modules/websites/htdocs/images", ]
+ }
+
+ # Web index
+ file { "${apache::www_folder}/index.html":
+ ensure => present,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ source => [ "puppet:///modules/site_apache/htdocs/${::domain}/index.html",
+ "puppet:///modules/websites/htdocs/index.html", ]
+ }
+
+ # Missing page
+ file { "${apache::www_folder}/missing.html":
+ ensure => present,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ source => [ "puppet:///modules/site_apache/htdocs/${::domain}/missing.html",
+ "puppet:///modules/websites/htdocs/missing.html", ]
+ }
+
+ # Make sure that a top level index exists
+ file { "/var/www/index.html":
+ ensure => present,
+ }
+
+ # Default vhost: can just be applied on the defining host
+ apache::site { "${apache::server_name}":
+ server_alias => "${::domain}",
+ docroot => "${apache::www_folder}",
+ mpm => false,
+ tag => 'all',
+ }
+
+ # 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}",
+ filename => 'zzz-error',
+ mpm => false,
+ tag => 'all',
+ }
+
+ # Index page for error
+ file { "${apache::error_folder}/index.html":
+ ensure => "${apache::www_folder}/index.html",
+ owner => "root",
+ group => "root",
+ force => true,
+ 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"],
+ }
+
+}