This type will create an apache balancer cluster file inside the conf.d directory. Each balancer cluster needs one or more balancer members (that can be declared with the apache::balancermember defined resource type). Using storeconfigs, you can export the apache::balancermember resources on all balancer members, and then collect them on a single apache load balancer server.
Currently requires the puppetlabs/concat module on the Puppet Forge and uses storeconfigs on the Puppet Master to export/collect resources from all balancer members.
The namevar of the defined resource type is the balancer clusters name. This name is also used in the name of the conf.d file
Hash, default empty. If given, each key-value pair will be used as a ProxySet line in the configuration.
Boolean, default 'true'. True means 'collect exported @@balancermember resources' (for the case when every balancermember node exports itself), false means 'rely on the existing declared balancermember resources' (for the case when you know the full set of balancermembers in advance and use apache::balancermember with array arguments, which allows you to deploy everything in 1 run)
Exporting the resource for a balancer member:
apache::balancer { 'puppet00': }
This type will setup a balancer member inside a listening service configuration block in /etc/apache/apache.cfg on the load balancer. currently it only has the ability to specify the instance name, url and an array of options. More features can be added as needed. The best way to implement this is to export this resource for all apache balancer member servers, and then collect them on the main apache load balancer.
Currently requires the puppetlabs/concat module on the Puppet Forge and uses storeconfigs on the Puppet Master to export/collect resources from all balancer members.
The title of the resource is arbitrary and only utilized in the concat fragment name.
The apache service's instance name (or, the title of the apache::balancer resource). This must match up with a declared apache::balancer resource.
The url used to contact the balancer member server.
Definition: apache::vhost
This class installs Apache Virtual Hosts
Parameters:
The $port to configure the host on
The $docroot provides the DocumentRoot variable
The $virtual_docroot provides VirtualDocumentationRoot variable
The $serveradmin will specify an email address for Apache that it will display when it renders one of it's error pages
The $ssl option is set true or false to enable SSL for this Virtual Host
The $priority of the site
The $servername is the primary name of the virtual host
The $serveraliases of the site
The $ip to configure the host on, defaulting to *
The $options for the given vhost
The $override for the given vhost (list of AllowOverride arguments)
The $vhost_name for name based virtualhosting, defaulting to *
The $logroot specifies the location of the virtual hosts logfiles, default to /var/log/<apache log location>/
The $log_level specifies the verbosity of the error log for this vhost. Not set by default for the vhost, instead the global server configuration default of 'warn' is used.
The $access_log specifies if *_access.log directives should be configured.
The $ensure specifies if vhost file is present or absent.
The $headers is a list of Header statement strings as per httpd.apache.org/docs/2.2/mod/mod_headers.html#header
The $request_headers is a list of RequestHeader statement strings as per httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader
$aliases is a list of Alias hashes for mod_alias as per httpd.apache.org/docs/current/mod/mod_alias.html each statement is a hash in the form of { alias => '/alias', path => '/real/path/to/directory' }
$directories is a lost of hashes for creating <Directory> statements as per httpd.apache.org/docs/2.2/mod/core.html#directory each statement is a hash in the form of { path => '/path/to/directory', <directive> => <value>} see README.md for list of supported directives.
Actions:
Install Apache Virtual Hosts
Requires:
The apache class
Sample Usage:
# Simple vhost definition: apache::vhost { 'site.name.fqdn': port => '80', docroot => '/path/to/docroot', } # Multiple Mod Rewrites: apache::vhost { 'site.name.fqdn': port => '80', docroot => '/path/to/docroot', rewrites => [ { comment => 'force www domain', rewrite_cond => ['%{HTTP_HOST} ^([a-z.]+)?example.com$ [NC]', '%{HTTP_HOST} !^www. [NC]'], rewrite_rule => ['.? http://www.%1example.com%{REQUEST_URI} [R=301,L]'] }, { comment => 'prevent image hotlinking', rewrite_cond => ['%{HTTP_REFERER} !^$', '%{HTTP_REFERER} !^http://(www.)?example.com/ [NC]'], rewrite_rule => ['.(gif|jpg|png)$ - [F]'] }, ] } # SSL vhost with non-SSL rewrite: apache::vhost { 'site.name.fqdn': port => '443', ssl => true, docroot => '/path/to/docroot', } apache::vhost { 'site.name.fqdn': port => '80', docroot => '/path/to/other_docroot', custom_fragment => template("${module_name}/my_fragment.erb"), }