Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created September 6, 2012 19:38
Show Gist options
  • Save fapestniegd/3659783 to your computer and use it in GitHub Desktop.
Save fapestniegd/3659783 to your computer and use it in GitHub Desktop.
bundle agent httpd_server {
vars:
"packages" slist => {
"httpd",
"mod_ssl",
"mod_perl",
"mod_authz_ldap",
};
"services" slist => {
"httpd",
};
"files" slist => {
"/etc/httpd/vhost.d/localhost/default",
"/etc/httpd/vhost.d/localhost/dummy.conf",
"/etc/httpd/vhost.d/public/default",
"/etc/httpd/vhost.d/public/dummy.conf",
"/etc/httpd/vhost.d/ssl/default",
"/etc/httpd/vhost.d/ssl/dummy.conf",
"/etc/httpd/include/ssl.inc",
"/etc/httpd/Apache2/PassSSLVars.pm",
"/etc/httpd/Apache2/FilterSnoop.pm",
"/etc/httpd/Apache2/FilterObfuscate.pm",
"/etc/httpd/conf.d/adauth.cf",
"/etc/httpd/conf.d/authz_ldap.conf",
"/etc/httpd/conf.d/ssl.conf",
"/etc/httpd/conf.d/vhost.conf",
"/etc/httpd/vhost.d/localhost",
"/etc/pki/tls/certs/Thawte_SSL_CA_Bundle.pem",
"/usr/local/sbin/git2web",
"/usr/local/sbin/httpd_aliases"
};
"dirs" slist => {
"/etc/httpd/vhost.d/.",
"/etc/httpd/vhost.d/localhost/.",
"/etc/httpd/vhost.d/public/.",
"/etc/httpd/vhost.d/ssl/.",
"/etc/httpd/include/.",
"/usr/local/sbin/.",
};
packages:
httpd_server::
"$(packages)"
package_policy => "add",
package_architectures => { "i386" },
action => everyfourhours,
package_method => yum;
files:
"$(dirs)"
comment => "deploy directories required for httpd configuration",
perms => mog("755", "root", "root"),
create => 'true',
classes => if_repaired("restart_httpd");
"$(files)"
comment => "deploy files required for httpd configuration",
copy_from => local_dcp("${g.masterfiles}/config/httpd_server/$(files)"),
perms => mog("755", "root", "root"),
classes => if_repaired("restart_httpd");
processes:
"$(services)"
comment => "Check processes running for $(services)",
restart_class => "restart_$(services)";
commands:
restart_httpd::
"/sbin/service $(services) restart";
httpd_server::
"/usr/local/sbin/httpd_aliases",
classes => if_ok("restart_httpd");
@jfryman
Copy link

jfryman commented Sep 6, 2012

define apache::file($file) {
file { $file:
ensure => present,
source => 'puppet:///modules/apache/$file'
notify => Service['httpd'],
}
}

File {
owner => 'root',
group => 'root',
mode => '0755',
}

$packages = ["httpd", "mod_ssl", "mod_perl", "mod_authz_ldap"]

$files = [ "/etc/httpd/vhost.d/localhost/dummy.conf",
"/etc/httpd/vhost.d/public/default",
"/etc/httpd/vhost.d/public/dummy.conf",
"/etc/httpd/vhost.d/ssl/default",
"/etc/httpd/vhost.d/ssl/dummy.conf",
"/etc/httpd/include/ssl.inc",
"/etc/httpd/Apache2/PassSSLVars.pm",
"/etc/httpd/Apache2/FilterSnoop.pm",
"/etc/httpd/Apache2/FilterObfuscate.pm",
"/etc/httpd/conf.d/adauth.cf",
"/etc/httpd/conf.d/authz_ldap.conf",
"/etc/httpd/conf.d/ssl.conf",
"/etc/httpd/conf.d/vhost.conf",
"/etc/httpd/vhost.d/localhost",
"/etc/pki/tls/certs/Thawte_SSL_CA_Bundle.pem",
"/usr/local/sbin/git2web",
"/usr/local/sbin/httpd_aliases"
]

$directories = [ "/etc/httpd/vhost.d/.",
"/etc/httpd/vhost.d/localhost/.",
"/etc/httpd/vhost.d/public/.",
"/etc/httpd/vhost.d/ssl/.",
"/etc/httpd/include/.",
"/usr/local/sbin/."
]

apache::file($files)

file { $directories:
ensure => directory,
notify => Service['httpd']
}

service { 'httpd':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment