diff modules/website/manifests/init.pp @ 0:956e484adc12

Initial public release of Puppet configs
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Aug 2014 19:47:38 +0000
parents
children f9876f71f1a3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/website/manifests/init.pp	Sat Aug 16 19:47:38 2014 +0000
@@ -0,0 +1,84 @@
+class website(
+  $base_dir,
+  $cert_dir           = '/etc/pki/custom',
+  $ssl_chain          = 'ca-chain.pem',
+  $primary_ip,
+  $secondary_ip,
+  $default_owner,
+  $default_group,
+  $default_tld        = 'com',
+  $default_extra_tlds = []
+  ){
+
+  validate_re($base_dir, '^(/[^/]+)*$',
+  "${base_dir} is invalid - base_dir must be a directory without trailing slash.")
+  validate_re($cert_dir, '^(/[^/]+)*$',
+  "${cert_dir} is invalid - cert_dir must be a directory without trailing slash.")
+  validate_array($default_extra_tlds)
+
+  $basedir = $base_dir
+  $certdir = $cert_dir
+  $docroot_owner = $default_owner
+  $docroot_group = $default_group
+  $ca_chain = $ssl_chain
+  $tld = $default_tld
+  $extra_tlds = $default_extra_tlds
+  $htmlphpfragment = "Include conf.extra/html-php.conf"
+  $filterfragment = "Include conf.custom/filter.conf"
+  $cmsfragment = "Include conf.extra/cms_rewrites.conf"
+
+  class { 'apache':
+    default_mods => false,
+    default_vhost => false,
+    mpm_module => false,
+  }
+  class { 'apache::mod::dir': indexes => [ 'index.html' ] }
+  class { 'apache::mod::prefork': serverlimit => 30, maxclients => 30 }
+  apache::mod {
+    'rewrite':;
+    'expires':; 'setenvif':; 'headers':;
+  }
+  file { $base_dir:
+    ensure => directory;
+  }
+  file { '/var/log/apache':
+    ensure => directory,
+    mode   => '0750',
+    group  => 'apache',
+  }
+  file { '/etc/httpd/conf.extra':
+    ensure => directory,
+    recurse => true,
+    source => "puppet:///modules/website/conf.extra",
+    notify => Service['httpd'];
+  }
+  file { '/etc/httpd/conf/mime.types':
+    ensure => present,
+    source => "puppet:///modules/website/mime.types",
+    notify => Service['httpd'];
+  }
+  file { '/etc/php.d/datetime.ini':
+    ensure => present,
+    source => "puppet:///modules/website/datetime.ini",
+    notify => Service['httpd'];
+  }
+  file { '/etc/httpd/conf.d/zzz-custom.conf':
+    ensure => present,
+    source => "puppet:///modules/website/zzz-custom.conf",
+    notify => Service['httpd'];
+  }
+  file { '/etc/httpd/conf.d/php.conf':
+    ensure => present,
+    source => "puppet:///modules/website/php.conf",
+    notify => Service['httpd'];
+  }
+  file { '/etc/httpd/conf.custom':
+    ensure => directory,
+    recurse => true,
+    source => "puppet:///private/apache/conf.custom",
+    notify => Service['httpd']; 
+  }
+  file { $cert_dir:
+    ensure => directory;
+  }
+}