Skip to content

Commit

Permalink
Merge pull request #68 from hunner/add_mod_lib_parameter
Browse files Browse the repository at this point in the history
Add mod lib parameter
  • Loading branch information
bodepd committed Aug 9, 2012
2 parents 12157f0 + 286b5cd commit 07b5790
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/a2mod/redhat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def preinit

def create
File.open(modfile,'w') do |f|
f.puts "LoadModule #{resource[:name]}_module modules/mod_#{resource[:name]}.so"
f.puts "LoadModule #{resource[:name]}_module modules/#{resource[:lib]}"
end
end

Expand All @@ -25,7 +25,7 @@ def destroy
end

def exists?
File.exists?(modfile)
File.exists?(modfile) and File.read(modfile).match(resource[:lib])
end

def self.instances
Expand Down
8 changes: 7 additions & 1 deletion lib/puppet/type/a2mod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

end

newparam(:lib) do
desc "The name of the .so library to be loaded"

defaultto { "mod_#{@resource[:name]}.so" }
end

autorequire(:package) { catalog.resource(:package, 'httpd')}

end
end
6 changes: 6 additions & 0 deletions manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
} elsif $mod_packages[$module] {
$package_REAL = $mod_packages[$module]
}
$mod_libs = $apache::params::mod_libs
if $mod_libs {
$lib = $mod_libs[$module]
}

if $package_REAL {
package { $package_REAL:
ensure => present,
Expand All @@ -18,6 +23,7 @@

a2mod { $module:
ensure => present,
lib => $lib,
require => Package['httpd'],
notify => Service['httpd']
}
Expand Down
7 changes: 7 additions & 0 deletions manifests/mod/php.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class apache::mod::php {
apache::mod { 'php5': }
file { "${apache::params::vdir}/php.conf":
ensure => present,
content => template('apache/mod/php.conf.erb'),
}
}
7 changes: 5 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@
'dev' => 'httpd-devel',
'fcgid' => 'mod_fcgid',
'perl' => 'mod_perl',
'php' => 'php',
'php5' => 'php',
'python' => 'mod_python',
'ssl' => 'mod_ssl',
'wsgi' => 'mod_wsgi',
}
$mod_libs = {
'php5' => 'libphp5.so',
}
} elsif $::osfamily == 'debian' {
$user = 'www-data'
$group = 'www-data'
Expand All @@ -70,7 +73,7 @@
'dev' => ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev'],
'fcgid' => 'libapache2-mod-fcgid',
'perl' => 'libapache2-mod-perl2',
'php' => 'libapache2-mod-php5',
'php5' => 'libapache2-mod-php5',
'python' => 'libapache2-mod-python',
'ssl' => 'apache-ssl',
'wsgi' => 'libapache2-mod-wsgi',
Expand Down
30 changes: 30 additions & 0 deletions templates/mod/php.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
#<IfModule prefork.c>
# LoadModule php5_module modules/libphp5.so
#</IfModule>
#<IfModule worker.c>
# # Use of the "ZTS" build with worker is experimental, and no shared
# # modules are supported.
# LoadModule php5_module modules/libphp5-zts.so
#</IfModule>

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

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

0 comments on commit 07b5790

Please sign in to comment.