Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active December 22, 2015 23:09
Show Gist options
  • Save binford2k/6544738 to your computer and use it in GitHub Desktop.
Save binford2k/6544738 to your computer and use it in GitHub Desktop.
class apache {
#### update this section #####
case $::osfamily {
'RedHat': {
$httpd_user = 'apache'
$httpd_group = 'apache'
$httpd_pkg = 'httpd'
$httpd_svc = 'httpd'
$httpd_conf = 'httpd.conf'
$httpd_confdir = '/etc/httpd/conf'
$httpd_docroot = '/var/www/html'
}
'Debian': {
$httpd_user = 'www-data'
$httpd_group = 'www-data'
$httpd_pkg = 'apache2'
$httpd_svc = 'apache2'
$httpd_conf = 'apache2.conf'
$httpd_confdir = '/etc/apache2'
$httpd_docroot = '/var/www'
}
default: {
fail("Module ${module_name} is not supported on ${::osfamily}")
}
}
##### end section update #####
File {
owner => /*em*/$httpd_user/*end*/,
group => /*em*/$httpd_group/*end*/,
mode => '0644',
}
package { /*em*/$httpd_pkg/*end*/:
ensure => present,
}
file { /*em*/'httpd_conf'/*end*/:
ensure => file,
path => /*em*/"${httpd_confdir}/${httpd_conf}"/*end*/,
owner => 'root',
group => 'root',
source => "puppet:///modules/apache//*em*/${httpd_conf}/*end*/",
require => Package[/* em */$httpd_pkg/*end*/],
}
#### update this section #####
# Note that we are now only managing the docroot, not the full path.
# We can assume that the package installation will create it.
file { $httpd_docroot:
ensure => directory,
}
#### end section update #####
file { "${httpd_docroot}/index.html": ## update this line
ensure => file,
source => 'puppet:///modules/apache/index.html',
}
service { $httpd_svc: ## update this line
ensure => running,
subscribe => File['httpd_conf'], ## update this line
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment