diff options
Diffstat (limited to 'manifests/subsystems/websites.pp')
| -rw-r--r-- | manifests/subsystems/websites.pp | 127 | 
1 files changed, 127 insertions, 0 deletions
diff --git a/manifests/subsystems/websites.pp b/manifests/subsystems/websites.pp new file mode 100644 index 0000000..b688860 --- /dev/null +++ b/manifests/subsystems/websites.pp @@ -0,0 +1,127 @@ +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" + +  $default_vhost = $apache_server_name ? { +    ''      => $hostname, +    default => $apache_server_name, +  } + +  # Include apache +  include apache + +  # The needed apache modules +  apache::module { "rewrite": +    ensure  => present, +  } + +  # 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://$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 { "$default_vhost": +    server_alias => "$domain", +    docroot      => "${apache_www_folder}", +  } + +  # 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', +  } + +  # 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"], +  } + +  # 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', +  } + +  # 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, +    owner   => "root", +    group   => "root", +    force   => true, +  } + +  # 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 gitweb +  include trac +  include websvn +  include moin +  include ikiwiki +  include pmwiki +} + +class websites::hosting::admin inherits websites::setup { +  # Include the needed classes for admin interfaces +  include trac +  include gitweb +}  | 
