Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created October 12, 2012 19:22
Show Gist options
  • Select an option

  • Save AutomatedTester/3880973 to your computer and use it in GitHub Desktop.

Select an option

Save AutomatedTester/3880973 to your computer and use it in GitHub Desktop.
# Red Hat, CentOS, and Fedora think Apache is the only web server
# ever, so we have to use a different package on CentOS than Ubuntu.
class apache {
case $operatingsystem {
centos: {
package { "httpd-devel":
ensure => present,
before => File['/etc/httpd/conf.d/orangefactor.conf'];
}
file { "/etc/httpd/conf.d/orangefactor.conf":
source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/orangefactor.conf",
owner => "root", group => "root", mode => 0644,
require => [
Package['httpd-devel']
];
}
service { "httpd":
ensure => running,
enable => true,
hasrestart => true,
restart => '/etc/init.d/apache2 reload',
require => [
Package['httpd-devel'],
File['/etc/httpd/conf.d/orangefactor.conf']
];
}
}
ubuntu: {
package { "apache2-dev":
ensure => present,
before => File['/etc/apache2/sites-available/orangefactor.conf'];
}
file { "/etc/apache2/sites-available/orangefactor.conf":
source => "$PROJ_DIR/puppet/files/etc/httpd/conf.d/orangefactor.conf",
owner => "root", group => "root", mode => 0644,
require => [
Package['apache2-dev']
];
}
exec {
'a2enmod rewrite':
onlyif => 'test ! -e /etc/apache2/mods-enabled/rewrite.load';
'a2enmod proxy':
onlyif => 'test ! -e /etc/apache2/mods-enabled/proxy.load';
}
exec{
"enable-vhost":
command => "/usr/sbin/a2ensite orangefactor.conf",
refreshonly => true,
require => [ File["/etc/apache2/sites-available/orangefactor.conf"]],
notify => Service["apache2"];
}
service { "apache2":
ensure => running,
enable => true,
hasrestart => true,
restart => "/etc/init.d/apache2 reload",
require => [
Package['apache2-dev'],
File['/etc/apache2/sites-available/orangefactor.conf']
];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment