Skip to content

Commit

Permalink
improve Ubuntu/Debian support
Browse files Browse the repository at this point in the history
  • Loading branch information
mruzicka committed Apr 1, 2013
1 parent 46b48c2 commit 4019156
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 13 deletions.
12 changes: 9 additions & 3 deletions modules/apache2/manifests/config_include.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
define apache2::config_include($content) {
# TODO verify the locataion of config includes accross distros
$apache_config_include_dir = $::operatingsystem ? {
Ubuntu => '/etc/httpd/conf.d',
Ubuntu => '/etc/apache2/conf.d',
CentOS => '/etc/httpd/conf.d',
Debian => '/etc/httpd/conf.d',
Debian => '/etc/apache2/conf.d',
default => '/etc/httpd/conf.d',
}
$apache_config_file_suffix = $::operatingsystem ? {
Ubuntu => '',
CentOS => '.conf',
Debian => '',
default => '.conf',
}

file { "${apache_config_include_dir}/${name}.conf":
file { "${apache_config_include_dir}/${name}${$apache_config_file_suffix}":
ensure => present,
content => "${content}",
owner => root,
Expand Down
29 changes: 29 additions & 0 deletions modules/apache2/manifests/module.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
define apache2::module($ensure = 'enabled') {
case $::operatingsystem {
'debian', 'ubuntu': {
case $ensure {
'enabled': {
$command = 'a2enmod'
$test = '!'
}

default: {
$command = 'a2dismod'
$test = ''
}
}

exec { "apache2-module-${title}":
onlyif => "test ${test} -e '/etc/apache2/mods-enabled/${title}.load'",
command => "${command} '${title}'",
path => ['/usr/local/bin', '/sbin', '/bin', '/usr/sbin', '/usr/bin'],
require => Package['apache2'],
notify => Service['apache2-service'],
}
}

default: {
notice('not supported')
}
}
}
8 changes: 5 additions & 3 deletions modules/php5/manifests/apache_module.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
include apache2

$php = $::operatingsystem ? {
Ubuntu => 'php5',
Ubuntu => 'libapache2-mod-php5',
CentOS => 'php',
Debian => 'php5',
Debian => 'libapache2-mod-php5',
default => 'php',
}

package { 'php5-apache_module':
package { 'php5-apache2_module':
name => "${php}",
ensure => latest,
subscribe => Package['php5-common'],
notify => Service['apache2-service'],
}

Service['apache2-service'] <~ Php5::Plugin<| |>
}
7 changes: 1 addition & 6 deletions modules/php5/manifests/mysql.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
class php5::mysql {
include php5::common

$php_mysql = $::operatingsystem ? {
Ubuntu => 'php5-mysql',
CentOS => 'php-mysql',
Debian => 'php5-mysql',
default => 'php-mysql',
}

package { 'php5-mysql':
name => "${php_mysql}",
ensure => latest,
notify => Package['php5-common'],
php5::plugin { $php_mysql:
}
}
7 changes: 7 additions & 0 deletions modules/php5/manifests/plugin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
define php5::plugin() {
include php5::common

package { $title:
ensure => latest,
}
}
2 changes: 1 addition & 1 deletion modules/wordpress/templates/wordpress.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Alias /<%= instance_alias %> "<%= instance_root %>"
AllowOverride None

#
# Cause the PHP interpreter to handle files with a .php extension.
# Cause the specified handler to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
Expand Down

0 comments on commit 4019156

Please sign in to comment.