Last active
December 22, 2015 23:09
-
-
Save binford2k/6544738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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