1 require 'puppet/provider/a2mod'
3 Puppet::Type.type(:a2mod).provide(:redhat, :parent => Puppet::Provider::A2mod) do
4 desc "Manage Apache 2 modules on RedHat family OSs"
6 commands :apachectl => "apachectl"
8 confine :osfamily => :redhat
9 defaultfor :osfamily => :redhat
13 # modpath: Path to default apache modules directory /etc/httpd/mod.d
14 # modfile: Path to module load configuration file; Default: resides under modpath directory
15 # libfile: Path to actual apache module library. Added in modfile LoadModule
17 attr_accessor :modfile, :libfile
19 attr_accessor :modpath
21 @modpath = "/etc/httpd/mod.d"
28 File.open(modfile,'w') do |f|
29 f.puts "LoadModule #{resource[:identifier]} #{libfile}"
38 modules = apachectl("-M").lines.collect { |line|
39 m = line.match(/(\w+)_module \(shared\)$/)
53 modfile ||= "#{self.class.modpath}/#{resource[:name]}.load"
56 # Set libfile path: If absolute path is passed, then maintain it. Else, make it default from 'modules' dir.
58 libfile = Pathname.new(resource[:lib]).absolute? ? resource[:lib] : "modules/#{resource[:lib]}"