Permalink
Browse files

Extend each module to support Debian. Tested on Squeeze. Known issues…

… - will not use production database settings - limited to sqlite3

Smart proxy runs and shows in the Foreman UI. Actual control of TFTP
not tested.
  • Loading branch information...
1 parent 5da5801 commit c609ef00f8d3a7c822eeb75bbf6679e0edfcd1f0 Greg Sutcliffe committed Nov 1, 2011
Showing with 51 additions and 21 deletions.
  1. +2 −2 manifests/config.pp
  2. +10 −1 manifests/install.pp
  3. +5 −3 manifests/params.pp
  4. +8 −2 manifests/service.pp
  5. +1 −1 manifests/site.pp
  6. +25 −12 manifests/ssl.pp
View
@@ -12,11 +12,11 @@
}
file{
- "/etc/httpd/conf/httpd.conf":
+ "$apache::params::configdir/$apache::params::conffile":
mode => 0644,
notify => Exec["reload-apache"],
require => Class["apache::install"];
- "/etc/httpd/conf.d":
+ "$apache::params::configdir/":
ensure => directory,
mode => 0644,
notify => Exec["reload-apache"],
View
@@ -1,3 +1,12 @@
class apache::install {
- package { "httpd": ensure => installed}
+ case $operatingsystem {
+ redhat,centos,fedora,Scientific: { $http_package = "httpd" }
+ Debian: { $http_package = "apache2" }
+ default: { fail("${hostname}: This module does not support operatingsystem $operatingsystem") }
+ }
+
+ package { $http_package:
+ ensure => installed,
+ alias => 'httpd'
+ }
}
View
@@ -1,5 +1,7 @@
class apache::params {
- $user = "apache"
- $group = "apache"
- $home = "/var/www"
+ $user = "apache" # Change to www-data for Debian
+ $group = "apache" # Change to www-data for Debian
+ $home = "/var/www"
+ $configdir = "/etc/httpd/conf.d" # Change to /etc/apache2/conf.d for Debian
+ $conffile = "/etc/httpd/conf/httpd.conf" # Change to apache2.conf for Debian
}
View
@@ -1,11 +1,17 @@
class apache::service {
- service { "httpd":
+ $http_service = $operatingsystem ? {
+ Debian => "apache2",
+ default => "httpd",
+ }
+
+ service { "$http_service":
ensure => running, enable => true, hasstatus => true, hasrestart => true,
+ alias => "httpd",
subscribe => Package["httpd"]
}
exec { "reload-apache":
- command => "/etc/init.d/httpd reload",
+ command => "/etc/init.d/$http_service reload",
onlyif => "/usr/sbin/apachectl -t",
require => Service["httpd"],
refreshonly => true,
View
@@ -1,7 +1,7 @@
define apache::site( $admin = "webmaster", $aliases = '', $docroot, $ensure = 'present', $rails = false) {
if $rails { include passenger }
- file { "/etc/httpd/conf.d/$name.conf":
+ file { "$apache::params::configdir/$name.conf":
mode => "644",
ensure => $ensure,
require => Package["httpd"],
View
@@ -1,16 +1,29 @@
class apache::ssl {
include apache
- package { "mod_ssl":
- ensure => present, require => Package["httpd"],
- notify => Class["apache::service"],
- }
- file {
- "/etc/httpd/conf.d/ssl.conf":
- mode => 0644, owner => root, group => root,
- notify => Exec["reload-apache"];
- ["/var/cache/mod_ssl", "/var/cache/mod_ssl/scache"]:
- ensure => directory,
- owner => apache, group => root, mode => 0700,
- notify => Exec["reload-apache"];
+
+ case $operatingsystem {
+ Debian: {
+ exec { "enable-ssl":
+ command => "/usr/sbin/a2enmod ssl",
+ unless => "/bin/ls /etc/apache2/mods-enabled/ssl.load",
+ notify => Service["httpd"],
+ require => Class["apache::install"],
+ }
+ }
+ default: {
+ package { "mod_ssl":
+ ensure => present, require => Package["httpd"],
+ notify => Class["apache::service"],
+ }
+ file {
+ "/etc/httpd/conf.d/ssl.conf":
+ mode => 0644, owner => root, group => root,
+ notify => Exec["reload-apache"];
+ ["/var/cache/mod_ssl", "/var/cache/mod_ssl/scache"]:
+ ensure => directory,
+ owner => apache, group => root, mode => 0700,
+ notify => Exec["reload-apache"];
+ }
+ }
}
}

0 comments on commit c609ef0

Please sign in to comment.