freighthop 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Puppetfile +4 -3
- data/Puppetfile.lock +14 -2
- data/Vagrantfile +5 -1
- data/data/common.json +4 -3
- data/freighthop.gemspec +1 -1
- data/lib/freighthop/cli/checks.rb +12 -0
- data/lib/freighthop/cli/help.rb +7 -0
- data/lib/freighthop/cli/init.rb +35 -0
- data/lib/freighthop/cli/ssh.rb +1 -0
- data/lib/freighthop/cli/vagrant.rb +1 -0
- data/lib/freighthop/cli.rb +5 -17
- data/lib/freighthop/config.rb +5 -1
- data/lib/freighthop/version.rb +1 -1
- data/lib/freighthop.rb +6 -1
- data/local_modules/freighthop/manifests/database/mysql/grant.pp +11 -0
- data/local_modules/freighthop/manifests/database/mysql.pp +5 -15
- data/local_modules/freighthop/manifests/database/postgres.pp +2 -2
- data/local_modules/freighthop/manifests/database.pp +3 -3
- data/local_modules/freighthop/manifests/init.pp +6 -23
- data/local_modules/freighthop/manifests/language/ruby.pp +5 -25
- data/local_modules/freighthop/manifests/language.pp +1 -4
- data/local_modules/freighthop/manifests/packages.pp +2 -12
- data/local_modules/freighthop/manifests/params.pp +19 -11
- data/local_modules/freighthop/manifests/web/apache.pp +60 -0
- data/local_modules/freighthop/manifests/web/nginx.pp +22 -0
- data/local_modules/freighthop/manifests/web/ssl.pp +13 -0
- data/local_modules/freighthop/manifests/web.pp +25 -21
- data/local_modules/freighthop/templates/apache/passenger.conf.erb +18 -0
- data/local_modules/freighthop/templates/nginx/vagrant-rails.conf.erb +5 -3
- data/modules/apache/CHANGELOG.md +172 -0
- data/modules/apache/CONTRIBUTING.md +234 -0
- data/modules/apache/Gemfile +25 -0
- data/modules/apache/LICENSE +15 -0
- data/modules/apache/Modulefile +12 -0
- data/modules/apache/README.md +1515 -0
- data/modules/apache/README.passenger.md +93 -0
- data/modules/apache/Rakefile +1 -0
- data/modules/apache/files/httpd +24 -0
- data/modules/apache/lib/puppet/provider/a2mod/a2mod.rb +35 -0
- data/modules/apache/lib/puppet/provider/a2mod/gentoo.rb +116 -0
- data/modules/apache/lib/puppet/provider/a2mod/modfix.rb +12 -0
- data/modules/apache/lib/puppet/provider/a2mod/redhat.rb +60 -0
- data/modules/apache/lib/puppet/provider/a2mod.rb +34 -0
- data/modules/apache/lib/puppet/type/a2mod.rb +30 -0
- data/modules/apache/manifests/balancer.pp +80 -0
- data/modules/apache/manifests/balancermember.pp +52 -0
- data/modules/apache/manifests/confd/no_accf.pp +10 -0
- data/modules/apache/manifests/default_confd_files.pp +12 -0
- data/modules/apache/manifests/default_mods/load.pp +8 -0
- data/modules/apache/manifests/default_mods.pp +108 -0
- data/modules/apache/manifests/dev.pp +11 -0
- data/modules/apache/manifests/init.pp +329 -0
- data/modules/apache/manifests/listen.pp +9 -0
- data/modules/apache/manifests/mod/alias.pp +17 -0
- data/modules/apache/manifests/mod/auth_basic.pp +3 -0
- data/modules/apache/manifests/mod/auth_kerb.pp +5 -0
- data/modules/apache/manifests/mod/authnz_ldap.pp +19 -0
- data/modules/apache/manifests/mod/autoindex.pp +12 -0
- data/modules/apache/manifests/mod/cache.pp +3 -0
- data/modules/apache/manifests/mod/cgi.pp +4 -0
- data/modules/apache/manifests/mod/cgid.pp +23 -0
- data/modules/apache/manifests/mod/dav.pp +3 -0
- data/modules/apache/manifests/mod/dav_fs.pp +20 -0
- data/modules/apache/manifests/mod/dav_svn.pp +5 -0
- data/modules/apache/manifests/mod/deflate.pp +12 -0
- data/modules/apache/manifests/mod/dev.pp +5 -0
- data/modules/apache/manifests/mod/dir.pp +21 -0
- data/modules/apache/manifests/mod/disk_cache.pp +24 -0
- data/modules/apache/manifests/mod/event.pp +54 -0
- data/modules/apache/manifests/mod/expires.pp +3 -0
- data/modules/apache/manifests/mod/fastcgi.pp +24 -0
- data/modules/apache/manifests/mod/fcgid.pp +3 -0
- data/modules/apache/manifests/mod/headers.pp +3 -0
- data/modules/apache/manifests/mod/include.pp +3 -0
- data/modules/apache/manifests/mod/info.pp +14 -0
- data/modules/apache/manifests/mod/itk.pp +64 -0
- data/modules/apache/manifests/mod/ldap.pp +12 -0
- data/modules/apache/manifests/mod/mime.pp +21 -0
- data/modules/apache/manifests/mod/mime_magic.pp +14 -0
- data/modules/apache/manifests/mod/negotiation.pp +12 -0
- data/modules/apache/manifests/mod/nss.pp +25 -0
- data/modules/apache/manifests/mod/passenger.pp +38 -0
- data/modules/apache/manifests/mod/perl.pp +3 -0
- data/modules/apache/manifests/mod/peruser.pp +73 -0
- data/modules/apache/manifests/mod/php.pp +26 -0
- data/modules/apache/manifests/mod/prefork.pp +74 -0
- data/modules/apache/manifests/mod/proxy.pp +15 -0
- data/modules/apache/manifests/mod/proxy_ajp.pp +4 -0
- data/modules/apache/manifests/mod/proxy_balancer.pp +10 -0
- data/modules/apache/manifests/mod/proxy_html.pp +28 -0
- data/modules/apache/manifests/mod/proxy_http.pp +4 -0
- data/modules/apache/manifests/mod/python.pp +5 -0
- data/modules/apache/manifests/mod/reqtimeout.pp +12 -0
- data/modules/apache/manifests/mod/rewrite.pp +4 -0
- data/modules/apache/manifests/mod/rpaf.pp +20 -0
- data/modules/apache/manifests/mod/setenvif.pp +12 -0
- data/modules/apache/manifests/mod/ssl.pp +26 -0
- data/modules/apache/manifests/mod/status.pp +42 -0
- data/modules/apache/manifests/mod/suphp.pp +14 -0
- data/modules/apache/manifests/mod/userdir.pp +17 -0
- data/modules/apache/manifests/mod/vhost_alias.pp +3 -0
- data/modules/apache/manifests/mod/worker.pp +75 -0
- data/modules/apache/manifests/mod/wsgi.pp +21 -0
- data/modules/apache/manifests/mod/xsendfile.pp +4 -0
- data/modules/apache/manifests/mod.pp +120 -0
- data/modules/apache/manifests/namevirtualhost.pp +9 -0
- data/modules/apache/manifests/package.pp +48 -0
- data/modules/apache/manifests/params.pp +207 -0
- data/modules/apache/manifests/peruser/multiplexer.pp +17 -0
- data/modules/apache/manifests/peruser/processor.pp +17 -0
- data/modules/apache/manifests/php.pp +18 -0
- data/modules/apache/manifests/proxy.pp +15 -0
- data/modules/apache/manifests/python.pp +18 -0
- data/modules/apache/manifests/service.pp +35 -0
- data/modules/apache/manifests/ssl.pp +18 -0
- data/modules/apache/manifests/vhost.pp +516 -0
- data/modules/apache/spec/acceptance/basic_spec.rb +12 -0
- data/modules/apache/spec/acceptance/class_spec.rb +58 -0
- data/modules/apache/spec/acceptance/default_mods_spec.rb +97 -0
- data/modules/apache/spec/acceptance/itk_spec.rb +35 -0
- data/modules/apache/spec/acceptance/mod_php_spec.rb +52 -0
- data/modules/apache/spec/acceptance/mod_suphp_spec.rb +44 -0
- data/modules/apache/spec/acceptance/nodesets/centos-64-x64.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/default.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +8 -0
- data/modules/apache/spec/acceptance/nodesets/vagrant.key +27 -0
- data/modules/apache/spec/acceptance/prefork_worker_spec.rb +81 -0
- data/modules/apache/spec/acceptance/service_spec.rb +19 -0
- data/modules/apache/spec/acceptance/vhost_spec.rb +290 -0
- data/modules/apache/spec/classes/apache_spec.rb +464 -0
- data/modules/apache/spec/classes/dev_spec.rb +38 -0
- data/modules/apache/spec/classes/mod/auth_kerb_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/authnz_ldap_spec.rb +65 -0
- data/modules/apache/spec/classes/mod/dav_svn_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/dev_spec.rb +23 -0
- data/modules/apache/spec/classes/mod/dir_spec.rb +88 -0
- data/modules/apache/spec/classes/mod/event_spec.rb +17 -0
- data/modules/apache/spec/classes/mod/fastcgi_spec.rb +32 -0
- data/modules/apache/spec/classes/mod/fcgid_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/info_spec.rb +99 -0
- data/modules/apache/spec/classes/mod/itk_spec.rb +31 -0
- data/modules/apache/spec/classes/mod/mime_magic_spec.rb +93 -0
- data/modules/apache/spec/classes/mod/passenger_spec.rb +112 -0
- data/modules/apache/spec/classes/mod/perl_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/peruser_spec.rb +17 -0
- data/modules/apache/spec/classes/mod/php_spec.rb +99 -0
- data/modules/apache/spec/classes/mod/prefork_spec.rb +47 -0
- data/modules/apache/spec/classes/mod/proxy_html_spec.rb +45 -0
- data/modules/apache/spec/classes/mod/python_spec.rb +41 -0
- data/modules/apache/spec/classes/mod/rpaf_spec.rb +77 -0
- data/modules/apache/spec/classes/mod/ssl_spec.rb +53 -0
- data/modules/apache/spec/classes/mod/status_spec.rb +166 -0
- data/modules/apache/spec/classes/mod/suphp_spec.rb +27 -0
- data/modules/apache/spec/classes/mod/worker_spec.rb +44 -0
- data/modules/apache/spec/classes/mod/wsgi_spec.rb +54 -0
- data/modules/apache/spec/classes/params_spec.rb +21 -0
- data/modules/apache/spec/classes/service_spec.rb +109 -0
- data/modules/apache/spec/defines/mod_spec.rb +105 -0
- data/modules/apache/spec/defines/vhost_spec.rb +1152 -0
- data/modules/apache/spec/fixtures/modules/site_apache/templates/fake.conf.erb +1 -0
- data/modules/apache/spec/spec.opts +4 -0
- data/modules/apache/spec/spec_helper.rb +1 -0
- data/modules/apache/spec/spec_helper_acceptance.rb +27 -0
- data/modules/apache/spec/unit/provider/a2mod/gentoo_spec.rb +184 -0
- data/modules/apache/templates/confd/no-accf.conf.erb +4 -0
- data/modules/apache/templates/httpd.conf.erb +92 -0
- data/modules/apache/templates/listen.erb +6 -0
- data/modules/apache/templates/mod/alias.conf.erb +9 -0
- data/modules/apache/templates/mod/authnz_ldap.conf.erb +5 -0
- data/modules/apache/templates/mod/autoindex.conf.erb +56 -0
- data/modules/apache/templates/mod/cgid.conf.erb +1 -0
- data/modules/apache/templates/mod/dav_fs.conf.erb +1 -0
- data/modules/apache/templates/mod/deflate.conf.erb +4 -0
- data/modules/apache/templates/mod/dir.conf.erb +1 -0
- data/modules/apache/templates/mod/disk_cache.conf.erb +8 -0
- data/modules/apache/templates/mod/event.conf.erb +9 -0
- data/modules/apache/templates/mod/fastcgi.conf.erb +6 -0
- data/modules/apache/templates/mod/info.conf.erb +6 -0
- data/modules/apache/templates/mod/itk.conf.erb +8 -0
- data/modules/apache/templates/mod/ldap.conf.erb +7 -0
- data/modules/apache/templates/mod/mime.conf.erb +36 -0
- data/modules/apache/templates/mod/mime_magic.conf.erb +1 -0
- data/modules/apache/templates/mod/mpm_event.conf.erb +9 -0
- data/modules/apache/templates/mod/negotiation.conf.erb +2 -0
- data/modules/apache/templates/mod/nss.conf.erb +228 -0
- data/modules/apache/templates/mod/passenger.conf.erb +30 -0
- data/modules/apache/templates/mod/peruser.conf.erb +12 -0
- data/modules/apache/templates/mod/php5.conf.erb +30 -0
- data/modules/apache/templates/mod/prefork.conf.erb +8 -0
- data/modules/apache/templates/mod/proxy.conf.erb +23 -0
- data/modules/apache/templates/mod/proxy_html.conf.erb +24 -0
- data/modules/apache/templates/mod/reqtimeout.conf.erb +2 -0
- data/modules/apache/templates/mod/rpaf.conf.erb +15 -0
- data/modules/apache/templates/mod/setenvif.conf.erb +34 -0
- data/modules/apache/templates/mod/ssl.conf.erb +24 -0
- data/modules/apache/templates/mod/status.conf.erb +12 -0
- data/modules/apache/templates/mod/suphp.conf.erb +19 -0
- data/modules/apache/templates/mod/userdir.conf.erb +19 -0
- data/modules/apache/templates/mod/worker.conf.erb +9 -0
- data/modules/apache/templates/mod/wsgi.conf.erb +13 -0
- data/modules/apache/templates/namevirtualhost.erb +8 -0
- data/modules/apache/templates/ports_header.erb +5 -0
- data/modules/apache/templates/vhost/_aliases.erb +12 -0
- data/modules/apache/templates/vhost/_block.erb +10 -0
- data/modules/apache/templates/vhost/_custom_fragment.erb +5 -0
- data/modules/apache/templates/vhost/_directories.erb +143 -0
- data/modules/apache/templates/vhost/_error_document.erb +7 -0
- data/modules/apache/templates/vhost/_fastcgi.erb +18 -0
- data/modules/apache/templates/vhost/_itk.erb +28 -0
- data/modules/apache/templates/vhost/_php_admin.erb +12 -0
- data/modules/apache/templates/vhost/_proxy.erb +20 -0
- data/modules/apache/templates/vhost/_rack.erb +7 -0
- data/modules/apache/templates/vhost/_redirect.erb +12 -0
- data/modules/apache/templates/vhost/_requestheader.erb +10 -0
- data/modules/apache/templates/vhost/_rewrite.erb +40 -0
- data/modules/apache/templates/vhost/_scriptalias.erb +24 -0
- data/modules/apache/templates/vhost/_serveralias.erb +7 -0
- data/modules/apache/templates/vhost/_setenv.erb +12 -0
- data/modules/apache/templates/vhost/_ssl.erb +41 -0
- data/modules/apache/templates/vhost/_suphp.erb +11 -0
- data/modules/apache/templates/vhost/_wsgi.erb +15 -0
- data/modules/apache/templates/vhost.conf.erb +63 -0
- data/modules/apache/tests/apache.pp +6 -0
- data/modules/apache/tests/dev.pp +1 -0
- data/modules/apache/tests/init.pp +1 -0
- data/modules/apache/tests/mod_load_params.pp +11 -0
- data/modules/apache/tests/mods.pp +9 -0
- data/modules/apache/tests/mods_custom.pp +16 -0
- data/modules/apache/tests/php.pp +4 -0
- data/modules/apache/tests/vhost.pp +237 -0
- data/modules/apache/tests/vhost_directories.pp +30 -0
- data/modules/apache/tests/vhost_ip_based.pp +25 -0
- data/modules/apache/tests/vhost_ssl.pp +23 -0
- data/modules/apache/tests/vhosts_without_listen.pp +53 -0
- data/modules/freighthop/manifests/database/mysql/grant.pp +11 -0
- data/modules/freighthop/manifests/database/mysql.pp +5 -15
- data/modules/freighthop/manifests/database/postgres.pp +2 -2
- data/modules/freighthop/manifests/database.pp +3 -3
- data/modules/freighthop/manifests/init.pp +6 -23
- data/modules/freighthop/manifests/language/ruby.pp +5 -25
- data/modules/freighthop/manifests/language.pp +1 -4
- data/modules/freighthop/manifests/packages.pp +2 -12
- data/modules/freighthop/manifests/params.pp +19 -11
- data/modules/freighthop/manifests/web/apache.pp +60 -0
- data/modules/freighthop/manifests/web/nginx.pp +22 -0
- data/modules/freighthop/manifests/web/ssl.pp +13 -0
- data/modules/freighthop/manifests/web.pp +25 -21
- data/modules/freighthop/templates/apache/passenger.conf.erb +18 -0
- data/modules/freighthop/templates/nginx/vagrant-rails.conf.erb +5 -3
- data/modules/rbenv/AUTHORS +11 -0
- data/modules/rbenv/CHANGELOG.md +70 -0
- data/modules/rbenv/Gemfile +5 -10
- data/modules/rbenv/Gemfile.lock +16 -58
- data/modules/rbenv/Modulefile +7 -7
- data/modules/rbenv/README.md +156 -20
- data/modules/rbenv/Rakefile +18 -24
- data/modules/rbenv/TODO +10 -0
- data/modules/rbenv/bin/autospec +16 -0
- data/modules/rbenv/bin/facter +16 -0
- data/modules/rbenv/bin/filebucket +16 -0
- data/modules/rbenv/bin/hiera +16 -0
- data/modules/rbenv/bin/htmldiff +16 -0
- data/modules/rbenv/bin/ldiff +16 -0
- data/modules/rbenv/bin/pi +16 -0
- data/modules/rbenv/bin/puppet +16 -0
- data/modules/rbenv/bin/puppet-lint +16 -0
- data/modules/rbenv/bin/puppet-module +16 -0
- data/modules/rbenv/bin/puppetca +16 -0
- data/modules/rbenv/bin/puppetd +16 -0
- data/modules/rbenv/bin/puppetdoc +16 -0
- data/modules/rbenv/bin/puppetmasterd +16 -0
- data/modules/rbenv/bin/puppetqd +16 -0
- data/modules/rbenv/bin/puppetrun +16 -0
- data/modules/rbenv/bin/rake +16 -0
- data/modules/rbenv/bin/ralsh +16 -0
- data/modules/rbenv/bin/rspec +16 -0
- data/modules/rbenv/bin/rspec-puppet-init +16 -0
- data/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
- data/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
- data/modules/rbenv/manifests/bundle.pp +36 -0
- data/modules/rbenv/manifests/client.pp +48 -0
- data/modules/rbenv/manifests/compile.pp +102 -0
- data/modules/rbenv/manifests/definition.pp +31 -0
- data/modules/rbenv/manifests/dependencies/centos.pp +25 -0
- data/modules/rbenv/manifests/dependencies/suse.pp +28 -0
- data/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
- data/modules/rbenv/manifests/dependencies.pp +8 -0
- data/modules/rbenv/manifests/gem.pp +29 -0
- data/modules/rbenv/manifests/install.pp +55 -0
- data/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
- data/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
- data/modules/rbenv/manifests/plugin.pp +40 -0
- data/modules/rbenv/metadata.json +99 -31
- data/modules/rbenv/spec/classes/dependencies_spec.rb +20 -0
- data/modules/rbenv/spec/defines/rbenv__compile_spec.rb +34 -0
- data/modules/rbenv/spec/defines/rbenv__definition_spec.rb +40 -0
- data/modules/rbenv/spec/defines/rbenv__install_spec.rb +24 -0
- data/modules/rbenv/spec/defines/rbenv__plugin__rbenvvars_spec.rb +14 -0
- data/modules/rbenv/spec/defines/rbenv__plugin__rubybuild_spec.rb +14 -0
- data/modules/rbenv/spec/defines/rbenv__plugin_spec.rb +31 -0
- data/modules/rbenv/spec/fixtures/manifests/site.pp +0 -0
- data/modules/rbenv/spec/spec_helper.rb +6 -1
- data/modules/rbenv/templates/Gemfile.erb +5 -0
- data/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
- metadata +271 -23
- data/modules/rbenv/CHANGELOG +0 -33
- data/modules/rbenv/LICENSE +0 -20
- data/modules/rbenv/manifests/alias.pp +0 -32
- data/modules/rbenv/manifests/global.pp +0 -22
- data/modules/rbenv/manifests/init.pp +0 -30
- data/modules/rbenv/manifests/params.pp +0 -16
- data/modules/rbenv/manifests/rehash.pp +0 -28
- data/modules/rbenv/manifests/version.pp +0 -63
- data/modules/rbenv/spec/classes/rbenv__global_spec.rb +0 -31
- data/modules/rbenv/spec/classes/rbenv_spec.rb +0 -30
- data/modules/rbenv/spec/defines/rbenv__alias_spec.rb +0 -22
- data/modules/rbenv/spec/defines/rbenv__rehash_spec.rb +0 -22
- data/modules/rbenv/spec/defines/rbenv__version_spec.rb +0 -60
- data/modules/rbenv/spec/spec_helper_system.rb +0 -16
- data/modules/rbenv/spec/system/basic_spec.rb +0 -13
- data/modules/rbenv/templates/etc/profile.d/rbenv.sh.erb +0 -2
- data/modules/rbenv/tests/init.pp +0 -12
@@ -0,0 +1,516 @@
|
|
1
|
+
# Definition: apache::vhost
|
2
|
+
#
|
3
|
+
# This class installs Apache Virtual Hosts
|
4
|
+
#
|
5
|
+
# Parameters:
|
6
|
+
# - The $port to configure the host on
|
7
|
+
# - The $docroot provides the DocumentRoot variable
|
8
|
+
# - The $virtual_docroot provides VirtualDocumentationRoot variable
|
9
|
+
# - The $serveradmin will specify an email address for Apache that it will
|
10
|
+
# display when it renders one of it's error pages
|
11
|
+
# - The $ssl option is set true or false to enable SSL for this Virtual Host
|
12
|
+
# - The $priority of the site
|
13
|
+
# - The $servername is the primary name of the virtual host
|
14
|
+
# - The $serveraliases of the site
|
15
|
+
# - The $ip to configure the host on, defaulting to *
|
16
|
+
# - The $options for the given vhost
|
17
|
+
# - The $override for the given vhost (list of AllowOverride arguments)
|
18
|
+
# - The $vhost_name for name based virtualhosting, defaulting to *
|
19
|
+
# - The $logroot specifies the location of the virtual hosts logfiles, default
|
20
|
+
# to /var/log/<apache log location>/
|
21
|
+
# - The $log_level specifies the verbosity of the error log for this vhost. Not
|
22
|
+
# set by default for the vhost, instead the global server configuration default
|
23
|
+
# of 'warn' is used.
|
24
|
+
# - The $access_log specifies if *_access.log directives should be configured.
|
25
|
+
# - The $ensure specifies if vhost file is present or absent.
|
26
|
+
# - The $request_headers is a list of RequestHeader statement strings as per http://httpd.apache.org/docs/2.2/mod/mod_headers.html#requestheader
|
27
|
+
# - $aliases is a list of Alias hashes for mod_alias as per http://httpd.apache.org/docs/current/mod/mod_alias.html
|
28
|
+
# each statement is a hash in the form of { alias => '/alias', path => '/real/path/to/directory' }
|
29
|
+
# - $directories is a lost of hashes for creating <Directory> statements as per http://httpd.apache.org/docs/2.2/mod/core.html#directory
|
30
|
+
# each statement is a hash in the form of { path => '/path/to/directory', <directive> => <value>}
|
31
|
+
# see README.md for list of supported directives.
|
32
|
+
#
|
33
|
+
# Actions:
|
34
|
+
# - Install Apache Virtual Hosts
|
35
|
+
#
|
36
|
+
# Requires:
|
37
|
+
# - The apache class
|
38
|
+
#
|
39
|
+
# Sample Usage:
|
40
|
+
#
|
41
|
+
# # Simple vhost definition:
|
42
|
+
# apache::vhost { 'site.name.fqdn':
|
43
|
+
# port => '80',
|
44
|
+
# docroot => '/path/to/docroot',
|
45
|
+
# }
|
46
|
+
#
|
47
|
+
# # Multiple Mod Rewrites:
|
48
|
+
# apache::vhost { 'site.name.fqdn':
|
49
|
+
# port => '80',
|
50
|
+
# docroot => '/path/to/docroot',
|
51
|
+
# rewrites => [
|
52
|
+
# {
|
53
|
+
# comment => 'force www domain',
|
54
|
+
# rewrite_cond => ['%{HTTP_HOST} ^([a-z.]+)?example.com$ [NC]', '%{HTTP_HOST} !^www. [NC]'],
|
55
|
+
# rewrite_rule => ['.? http://www.%1example.com%{REQUEST_URI} [R=301,L]']
|
56
|
+
# },
|
57
|
+
# {
|
58
|
+
# comment => 'prevent image hotlinking',
|
59
|
+
# rewrite_cond => ['%{HTTP_REFERER} !^$', '%{HTTP_REFERER} !^http://(www.)?example.com/ [NC]'],
|
60
|
+
# rewrite_rule => ['.(gif|jpg|png)$ - [F]']
|
61
|
+
# },
|
62
|
+
# ]
|
63
|
+
# }
|
64
|
+
#
|
65
|
+
# # SSL vhost with non-SSL rewrite:
|
66
|
+
# apache::vhost { 'site.name.fqdn':
|
67
|
+
# port => '443',
|
68
|
+
# ssl => true,
|
69
|
+
# docroot => '/path/to/docroot',
|
70
|
+
# }
|
71
|
+
# apache::vhost { 'site.name.fqdn':
|
72
|
+
# port => '80',
|
73
|
+
# rewrites => [
|
74
|
+
# {
|
75
|
+
# comment => "redirect non-SSL traffic to SSL site",
|
76
|
+
# rewrite_cond => ['%{HTTPS} off'],
|
77
|
+
# rewrite_rule => ['(.*) https://%{HTTPS_HOST}%{REQUEST_URI}']
|
78
|
+
# }
|
79
|
+
# ]
|
80
|
+
# }
|
81
|
+
# apache::vhost { 'site.name.fqdn':
|
82
|
+
# port => '80',
|
83
|
+
# docroot => '/path/to/other_docroot',
|
84
|
+
# custom_fragment => template("${module_name}/my_fragment.erb"),
|
85
|
+
# }
|
86
|
+
#
|
87
|
+
define apache::vhost(
|
88
|
+
$docroot,
|
89
|
+
$virtual_docroot = false,
|
90
|
+
$port = undef,
|
91
|
+
$ip = undef,
|
92
|
+
$ip_based = false,
|
93
|
+
$add_listen = true,
|
94
|
+
$docroot_owner = 'root',
|
95
|
+
$docroot_group = $apache::params::root_group,
|
96
|
+
$serveradmin = false,
|
97
|
+
$ssl = false,
|
98
|
+
$ssl_cert = $apache::default_ssl_cert,
|
99
|
+
$ssl_key = $apache::default_ssl_key,
|
100
|
+
$ssl_chain = $apache::default_ssl_chain,
|
101
|
+
$ssl_ca = $apache::default_ssl_ca,
|
102
|
+
$ssl_crl_path = $apache::default_ssl_crl_path,
|
103
|
+
$ssl_crl = $apache::default_ssl_crl,
|
104
|
+
$ssl_certs_dir = $apache::params::ssl_certs_dir,
|
105
|
+
$ssl_protocol = undef,
|
106
|
+
$ssl_cipher = undef,
|
107
|
+
$ssl_honorcipherorder = undef,
|
108
|
+
$ssl_verify_client = undef,
|
109
|
+
$ssl_verify_depth = undef,
|
110
|
+
$ssl_options = undef,
|
111
|
+
$ssl_proxyengine = false,
|
112
|
+
$priority = undef,
|
113
|
+
$default_vhost = false,
|
114
|
+
$servername = $name,
|
115
|
+
$serveraliases = [],
|
116
|
+
$options = ['Indexes','FollowSymLinks','MultiViews'],
|
117
|
+
$index_options = [],
|
118
|
+
$index_order_default = [],
|
119
|
+
$override = ['None'],
|
120
|
+
$directoryindex = '',
|
121
|
+
$vhost_name = '*',
|
122
|
+
$logroot = $apache::logroot,
|
123
|
+
$log_level = undef,
|
124
|
+
$access_log = true,
|
125
|
+
$access_log_file = undef,
|
126
|
+
$access_log_pipe = undef,
|
127
|
+
$access_log_syslog = undef,
|
128
|
+
$access_log_format = undef,
|
129
|
+
$access_log_env_var = undef,
|
130
|
+
$aliases = undef,
|
131
|
+
$directories = undef,
|
132
|
+
$error_log = true,
|
133
|
+
$error_log_file = undef,
|
134
|
+
$error_log_pipe = undef,
|
135
|
+
$error_log_syslog = undef,
|
136
|
+
$error_documents = [],
|
137
|
+
$fallbackresource = undef,
|
138
|
+
$scriptalias = undef,
|
139
|
+
$scriptaliases = [],
|
140
|
+
$proxy_dest = undef,
|
141
|
+
$proxy_pass = undef,
|
142
|
+
$suphp_addhandler = $apache::params::suphp_addhandler,
|
143
|
+
$suphp_engine = $apache::params::suphp_engine,
|
144
|
+
$suphp_configpath = $apache::params::suphp_configpath,
|
145
|
+
$php_admin_flags = [],
|
146
|
+
$php_admin_values = [],
|
147
|
+
$no_proxy_uris = [],
|
148
|
+
$redirect_source = '/',
|
149
|
+
$redirect_dest = undef,
|
150
|
+
$redirect_status = undef,
|
151
|
+
$rack_base_uris = undef,
|
152
|
+
$request_headers = undef,
|
153
|
+
$rewrites = undef,
|
154
|
+
$rewrite_rule = undef,
|
155
|
+
$rewrite_cond = undef,
|
156
|
+
$setenv = [],
|
157
|
+
$setenvif = [],
|
158
|
+
$block = [],
|
159
|
+
$ensure = 'present',
|
160
|
+
$wsgi_daemon_process = undef,
|
161
|
+
$wsgi_daemon_process_options = undef,
|
162
|
+
$wsgi_process_group = undef,
|
163
|
+
$wsgi_script_aliases = undef,
|
164
|
+
$custom_fragment = undef,
|
165
|
+
$itk = undef,
|
166
|
+
$fastcgi_server = undef,
|
167
|
+
$fastcgi_socket = undef,
|
168
|
+
$fastcgi_dir = undef,
|
169
|
+
$additional_includes = [],
|
170
|
+
) {
|
171
|
+
# The base class must be included first because it is used by parameter defaults
|
172
|
+
if ! defined(Class['apache']) {
|
173
|
+
fail('You must include the apache base class before using any apache defined resources')
|
174
|
+
}
|
175
|
+
$apache_name = $apache::params::apache_name
|
176
|
+
|
177
|
+
validate_re($ensure, '^(present|absent)$',
|
178
|
+
"${ensure} is not supported for ensure.
|
179
|
+
Allowed values are 'present' and 'absent'.")
|
180
|
+
validate_re($suphp_engine, '^(on|off)$',
|
181
|
+
"${suphp_engine} is not supported for suphp_engine.
|
182
|
+
Allowed values are 'on' and 'off'.")
|
183
|
+
validate_bool($ip_based)
|
184
|
+
validate_bool($access_log)
|
185
|
+
validate_bool($error_log)
|
186
|
+
validate_bool($ssl)
|
187
|
+
validate_bool($default_vhost)
|
188
|
+
validate_bool($ssl_proxyengine)
|
189
|
+
if $rewrites {
|
190
|
+
validate_array($rewrites)
|
191
|
+
validate_hash($rewrites[0])
|
192
|
+
}
|
193
|
+
|
194
|
+
# Deprecated backwards-compatibility
|
195
|
+
if $rewrite_rule {
|
196
|
+
warning('Apache::Vhost: parameter rewrite_rule is deprecated in favor of rewrites')
|
197
|
+
}
|
198
|
+
if $rewrite_cond {
|
199
|
+
warning('Apache::Vhost parameter rewrite_cond is deprecated in favor of rewrites')
|
200
|
+
}
|
201
|
+
|
202
|
+
if $wsgi_script_aliases {
|
203
|
+
validate_hash($wsgi_script_aliases)
|
204
|
+
}
|
205
|
+
if $wsgi_daemon_process_options {
|
206
|
+
validate_hash($wsgi_daemon_process_options)
|
207
|
+
}
|
208
|
+
if $itk {
|
209
|
+
validate_hash($itk)
|
210
|
+
}
|
211
|
+
|
212
|
+
if $log_level {
|
213
|
+
validate_re($log_level, '^(emerg|alert|crit|error|warn|notice|info|debug)$',
|
214
|
+
"Log level '${log_level}' is not one of the supported Apache HTTP Server log levels.")
|
215
|
+
}
|
216
|
+
|
217
|
+
if $access_log_file and $access_log_pipe {
|
218
|
+
fail("Apache::Vhost[${name}]: 'access_log_file' and 'access_log_pipe' cannot be defined at the same time")
|
219
|
+
}
|
220
|
+
|
221
|
+
if $error_log_file and $error_log_pipe {
|
222
|
+
fail("Apache::Vhost[${name}]: 'error_log_file' and 'error_log_pipe' cannot be defined at the same time")
|
223
|
+
}
|
224
|
+
|
225
|
+
if $fallbackresource {
|
226
|
+
validate_re($fallbackresource, '^/|disabled', 'Please make sure fallbackresource starts with a / (or is "disabled")')
|
227
|
+
}
|
228
|
+
|
229
|
+
if $ssl and $ensure == 'present' {
|
230
|
+
include apache::mod::ssl
|
231
|
+
# Required for the AddType lines.
|
232
|
+
include apache::mod::mime
|
233
|
+
}
|
234
|
+
|
235
|
+
if $virtual_docroot {
|
236
|
+
include apache::mod::vhost_alias
|
237
|
+
}
|
238
|
+
|
239
|
+
# This ensures that the docroot exists
|
240
|
+
# But enables it to be specified across multiple vhost resources
|
241
|
+
if ! defined(File[$docroot]) {
|
242
|
+
file { $docroot:
|
243
|
+
ensure => directory,
|
244
|
+
owner => $docroot_owner,
|
245
|
+
group => $docroot_group,
|
246
|
+
require => Package['httpd'],
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
# Same as above, but for logroot
|
251
|
+
if ! defined(File[$logroot]) {
|
252
|
+
file { $logroot:
|
253
|
+
ensure => directory,
|
254
|
+
require => Package['httpd'],
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
|
259
|
+
# Is apache::mod::passenger enabled (or apache::mod['passenger'])
|
260
|
+
$passenger_enabled = defined(Apache::Mod['passenger'])
|
261
|
+
|
262
|
+
# Define log file names
|
263
|
+
if $access_log_file {
|
264
|
+
$access_log_destination = "${logroot}/${access_log_file}"
|
265
|
+
} elsif $access_log_pipe {
|
266
|
+
$access_log_destination = "\"${access_log_pipe}\""
|
267
|
+
} elsif $access_log_syslog {
|
268
|
+
$access_log_destination = $access_log_syslog
|
269
|
+
} else {
|
270
|
+
if $ssl {
|
271
|
+
$access_log_destination = "${logroot}/${servername}_access_ssl.log"
|
272
|
+
} else {
|
273
|
+
$access_log_destination = "${logroot}/${servername}_access.log"
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
if $error_log_file {
|
278
|
+
$error_log_destination = "${logroot}/${error_log_file}"
|
279
|
+
} elsif $error_log_pipe {
|
280
|
+
$error_log_destination = "\"${error_log_pipe}\""
|
281
|
+
} elsif $error_log_syslog {
|
282
|
+
$error_log_destination = $error_log_syslog
|
283
|
+
} else {
|
284
|
+
if $ssl {
|
285
|
+
$error_log_destination = "${logroot}/${servername}_error_ssl.log"
|
286
|
+
} else {
|
287
|
+
$error_log_destination = "${logroot}/${servername}_error.log"
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
# Set access log format
|
292
|
+
if $access_log_format {
|
293
|
+
$_access_log_format = "\"${access_log_format}\""
|
294
|
+
} else {
|
295
|
+
$_access_log_format = 'combined'
|
296
|
+
}
|
297
|
+
|
298
|
+
if $access_log_env_var {
|
299
|
+
$_access_log_env_var = "env=${access_log_env_var}"
|
300
|
+
}
|
301
|
+
|
302
|
+
if $ip {
|
303
|
+
if $port {
|
304
|
+
$listen_addr_port = "${ip}:${port}"
|
305
|
+
$nvh_addr_port = "${ip}:${port}"
|
306
|
+
} else {
|
307
|
+
$nvh_addr_port = $ip
|
308
|
+
if ! $servername and ! $ip_based {
|
309
|
+
fail("Apache::Vhost[${name}]: must pass 'ip' and/or 'port' parameters for name-based vhosts")
|
310
|
+
}
|
311
|
+
}
|
312
|
+
} else {
|
313
|
+
if $port {
|
314
|
+
$listen_addr_port = $port
|
315
|
+
$nvh_addr_port = "${vhost_name}:${port}"
|
316
|
+
} else {
|
317
|
+
$nvh_addr_port = $name
|
318
|
+
if ! $servername {
|
319
|
+
fail("Apache::Vhost[${name}]: must pass 'ip' and/or 'port' parameters, and/or 'servername' parameter")
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
if $add_listen {
|
324
|
+
if $ip and defined(Apache::Listen[$port]) {
|
325
|
+
fail("Apache::Vhost[${name}]: Mixing IP and non-IP Listen directives is not possible; check the add_listen parameter of the apache::vhost define to disable this")
|
326
|
+
}
|
327
|
+
if ! defined(Apache::Listen[$listen_addr_port]) and $listen_addr_port and $ensure == 'present' {
|
328
|
+
apache::listen { $listen_addr_port: }
|
329
|
+
}
|
330
|
+
}
|
331
|
+
if ! $ip_based {
|
332
|
+
if ! defined(Apache::Namevirtualhost[$nvh_addr_port]) and $ensure == 'present' {
|
333
|
+
apache::namevirtualhost { $nvh_addr_port: }
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
# Load mod_rewrite if needed and not yet loaded
|
338
|
+
if $rewrites or $rewrite_cond {
|
339
|
+
if ! defined(Apache::Mod['rewrite']) {
|
340
|
+
apache::mod { 'rewrite': }
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
# Load mod_alias if needed and not yet loaded
|
345
|
+
if ($scriptalias or $scriptaliases != []) or ($redirect_source and $redirect_dest) {
|
346
|
+
if ! defined(Class['apache::mod::alias']) {
|
347
|
+
include apache::mod::alias
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
# Load mod_proxy if needed and not yet loaded
|
352
|
+
if ($proxy_dest or $proxy_pass) {
|
353
|
+
if ! defined(Class['apache::mod::proxy']) {
|
354
|
+
include apache::mod::proxy
|
355
|
+
}
|
356
|
+
if ! defined(Class['apache::mod::proxy_http']) {
|
357
|
+
include apache::mod::proxy_http
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
361
|
+
# Load mod_passenger if needed and not yet loaded
|
362
|
+
if $rack_base_uris {
|
363
|
+
if ! defined(Class['apache::mod::passenger']) {
|
364
|
+
include apache::mod::passenger
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
# Load mod_fastci if needed and not yet loaded
|
369
|
+
if $fastcgi_server and $fastcgi_socket {
|
370
|
+
if ! defined(Class['apache::mod::fastcgi']) {
|
371
|
+
include apache::mod::fastcgi
|
372
|
+
}
|
373
|
+
}
|
374
|
+
|
375
|
+
# Configure the defaultness of a vhost
|
376
|
+
if $priority {
|
377
|
+
$priority_real = $priority
|
378
|
+
} elsif $default_vhost {
|
379
|
+
$priority_real = '10'
|
380
|
+
} else {
|
381
|
+
$priority_real = '25'
|
382
|
+
}
|
383
|
+
|
384
|
+
# Check if mod_headers is required to process $request_headers
|
385
|
+
if $request_headers {
|
386
|
+
if ! defined(Class['apache::mod::headers']) {
|
387
|
+
include apache::mod::headers
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
## Apache include does not always work with spaces in the filename
|
392
|
+
$filename = regsubst($name, ' ', '_', 'G')
|
393
|
+
|
394
|
+
## Create a default directory list if none defined
|
395
|
+
if $directories {
|
396
|
+
$_directories = $directories
|
397
|
+
} else {
|
398
|
+
$_directories = [ {
|
399
|
+
provider => 'directory',
|
400
|
+
path => $docroot,
|
401
|
+
options => $options,
|
402
|
+
allow_override => $override,
|
403
|
+
directoryindex => $directoryindex,
|
404
|
+
order => 'allow,deny',
|
405
|
+
allow => 'from all',
|
406
|
+
} ]
|
407
|
+
}
|
408
|
+
|
409
|
+
# Template uses:
|
410
|
+
# - $nvh_addr_port
|
411
|
+
# - $servername
|
412
|
+
# - $serveradmin
|
413
|
+
# - $docroot
|
414
|
+
# - $virtual_docroot
|
415
|
+
# - $options
|
416
|
+
# - $override
|
417
|
+
# - $logroot
|
418
|
+
# - $name
|
419
|
+
# - $aliases
|
420
|
+
# - $_directories
|
421
|
+
# - $log_level
|
422
|
+
# - $access_log
|
423
|
+
# - $access_log_destination
|
424
|
+
# - $_access_log_format
|
425
|
+
# - $_access_log_env_var
|
426
|
+
# - $error_log
|
427
|
+
# - $error_log_destination
|
428
|
+
# - $error_documents
|
429
|
+
# - $fallbackresource
|
430
|
+
# - $custom_fragment
|
431
|
+
# - $additional_includes
|
432
|
+
# block fragment:
|
433
|
+
# - $block
|
434
|
+
# directories fragment:
|
435
|
+
# - $passenger_enabled
|
436
|
+
# - $php_admin_flags
|
437
|
+
# - $php_admin_values
|
438
|
+
# - $directories (a list of key-value hashes is expected)
|
439
|
+
# fastcgi fragment:
|
440
|
+
# - $fastcgi_server
|
441
|
+
# - $fastcgi_socket
|
442
|
+
# - $fastcgi_dir
|
443
|
+
# proxy fragment:
|
444
|
+
# - $proxy_dest
|
445
|
+
# - $no_proxy_uris
|
446
|
+
# rack fragment:
|
447
|
+
# - $rack_base_uris
|
448
|
+
# redirect fragment:
|
449
|
+
# - $redirect_source
|
450
|
+
# - $redirect_dest
|
451
|
+
# - $redirect_status
|
452
|
+
# requestheader fragment:
|
453
|
+
# - $request_headers
|
454
|
+
# rewrite fragment:
|
455
|
+
# - $rewrites
|
456
|
+
# scriptalias fragment:
|
457
|
+
# - $scriptalias
|
458
|
+
# - $scriptaliases
|
459
|
+
# - $ssl
|
460
|
+
# serveralias fragment:
|
461
|
+
# - $serveraliases
|
462
|
+
# setenv fragment:
|
463
|
+
# - $setenv
|
464
|
+
# - $setenvif
|
465
|
+
# ssl fragment:
|
466
|
+
# - $ssl
|
467
|
+
# - $ssl_cert
|
468
|
+
# - $ssl_key
|
469
|
+
# - $ssl_chain
|
470
|
+
# - $ssl_certs_dir
|
471
|
+
# - $ssl_ca
|
472
|
+
# - $ssl_crl
|
473
|
+
# - $ssl_crl_path
|
474
|
+
# - $ssl_verify_client
|
475
|
+
# - $ssl_verify_depth
|
476
|
+
# - $ssl_options
|
477
|
+
# suphp fragment:
|
478
|
+
# - $suphp_addhandler
|
479
|
+
# - $suphp_engine
|
480
|
+
# - $suphp_configpath
|
481
|
+
# wsgi fragment:
|
482
|
+
# - $wsgi_daemon_process
|
483
|
+
# - $wsgi_process_group
|
484
|
+
# - $wsgi_script_aliases
|
485
|
+
file { "${priority_real}-${filename}.conf":
|
486
|
+
ensure => $ensure,
|
487
|
+
path => "${apache::vhost_dir}/${priority_real}-${filename}.conf",
|
488
|
+
content => template('apache/vhost.conf.erb'),
|
489
|
+
owner => 'root',
|
490
|
+
group => $apache::params::root_group,
|
491
|
+
mode => '0644',
|
492
|
+
require => [
|
493
|
+
Package['httpd'],
|
494
|
+
File[$docroot],
|
495
|
+
File[$logroot],
|
496
|
+
],
|
497
|
+
notify => Service['httpd'],
|
498
|
+
}
|
499
|
+
if $::osfamily == 'Debian' {
|
500
|
+
$vhost_enable_dir = $apache::vhost_enable_dir
|
501
|
+
$vhost_symlink_ensure = $ensure ? {
|
502
|
+
present => link,
|
503
|
+
default => $ensure,
|
504
|
+
}
|
505
|
+
file{ "${priority_real}-${filename}.conf symlink":
|
506
|
+
ensure => $vhost_symlink_ensure,
|
507
|
+
path => "${vhost_enable_dir}/${priority_real}-${filename}.conf",
|
508
|
+
target => "${apache::vhost_dir}/${priority_real}-${filename}.conf",
|
509
|
+
owner => 'root',
|
510
|
+
group => $apache::params::root_group,
|
511
|
+
mode => '0644',
|
512
|
+
require => File["${priority_real}-${filename}.conf"],
|
513
|
+
notify => Service['httpd'],
|
514
|
+
}
|
515
|
+
}
|
516
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper_acceptance'
|
2
|
+
|
3
|
+
describe 'disable selinux:' do
|
4
|
+
it "because otherwise apache won't work" do
|
5
|
+
apply_manifest(%{
|
6
|
+
exec { "setenforce 0":
|
7
|
+
path => "/bin:/sbin:/usr/bin:/usr/sbin",
|
8
|
+
onlyif => "which setenforce && getenforce | grep Enforcing",
|
9
|
+
}
|
10
|
+
}, :catch_failures => true)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper_acceptance'
|
2
|
+
|
3
|
+
describe 'apache class' do
|
4
|
+
case fact('osfamily')
|
5
|
+
when 'RedHat'
|
6
|
+
package_name = 'httpd'
|
7
|
+
service_name = 'httpd'
|
8
|
+
when 'Debian'
|
9
|
+
package_name = 'apache2'
|
10
|
+
service_name = 'apache2'
|
11
|
+
when 'FreeBSD'
|
12
|
+
package_name = 'apache22'
|
13
|
+
service_name = 'apache22'
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'default parameters' do
|
17
|
+
it 'should work with no errors' do
|
18
|
+
pp = <<-EOS
|
19
|
+
class { 'apache': }
|
20
|
+
EOS
|
21
|
+
|
22
|
+
# Run it twice and test for idempotency
|
23
|
+
apply_manifest(pp, :catch_failures => true)
|
24
|
+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
|
25
|
+
end
|
26
|
+
|
27
|
+
describe package(package_name) do
|
28
|
+
it { should be_installed }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe service(service_name) do
|
32
|
+
it { should be_enabled }
|
33
|
+
it { should be_running }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'custom site/mod dir parameters' do
|
38
|
+
# Using puppet_apply as a helper
|
39
|
+
it 'should work with no errors' do
|
40
|
+
pp = <<-EOS
|
41
|
+
file { '/apache': ensure => directory, }
|
42
|
+
class { 'apache':
|
43
|
+
mod_dir => '/apache/mods',
|
44
|
+
vhost_dir => '/apache/vhosts',
|
45
|
+
}
|
46
|
+
EOS
|
47
|
+
|
48
|
+
# Run it twice and test for idempotency
|
49
|
+
apply_manifest(pp, :catch_failures => true)
|
50
|
+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
|
51
|
+
end
|
52
|
+
|
53
|
+
describe service(service_name) do
|
54
|
+
it { should be_enabled }
|
55
|
+
it { should be_running }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'spec_helper_acceptance'
|
2
|
+
|
3
|
+
case fact('osfamily')
|
4
|
+
when 'RedHat'
|
5
|
+
servicename = 'httpd'
|
6
|
+
when 'Debian'
|
7
|
+
servicename = 'apache2'
|
8
|
+
when 'FreeBSD'
|
9
|
+
servicename = 'apache22'
|
10
|
+
else
|
11
|
+
raise "Unconfigured OS for apache service on #{fact('osfamily')}"
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'apache::default_mods class' do
|
15
|
+
describe 'no default mods' do
|
16
|
+
# Using puppet_apply as a helper
|
17
|
+
it 'should apply with no errors' do
|
18
|
+
pp = <<-EOS
|
19
|
+
class { 'apache':
|
20
|
+
default_mods => false,
|
21
|
+
}
|
22
|
+
EOS
|
23
|
+
|
24
|
+
# Run it twice and test for idempotency
|
25
|
+
apply_manifest(pp, :catch_failures => true)
|
26
|
+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
|
27
|
+
end
|
28
|
+
|
29
|
+
describe service(servicename) do
|
30
|
+
it { should be_running }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'no default mods and failing' do
|
35
|
+
# Using puppet_apply as a helper
|
36
|
+
it 'should apply with errors' do
|
37
|
+
pp = <<-EOS
|
38
|
+
class { 'apache':
|
39
|
+
default_mods => false,
|
40
|
+
}
|
41
|
+
apache::vhost { 'defaults.example.com':
|
42
|
+
docroot => '/var/www/defaults',
|
43
|
+
aliases => {
|
44
|
+
alias => '/css',
|
45
|
+
path => '/var/www/css',
|
46
|
+
},
|
47
|
+
setenv => 'TEST1 one',
|
48
|
+
}
|
49
|
+
EOS
|
50
|
+
|
51
|
+
apply_manifest(pp, { :expect_failures => true })
|
52
|
+
end
|
53
|
+
|
54
|
+
# Are these the same?
|
55
|
+
describe service(servicename) do
|
56
|
+
it { should_not be_running }
|
57
|
+
end
|
58
|
+
describe "service #{servicename}" do
|
59
|
+
it 'should not be running' do
|
60
|
+
shell("pidof #{servicename}", {:acceptable_exit_codes => 1})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'alternative default mods' do
|
66
|
+
# Using puppet_apply as a helper
|
67
|
+
it 'should apply with no errors' do
|
68
|
+
pp = <<-EOS
|
69
|
+
class { 'apache':
|
70
|
+
default_mods => [
|
71
|
+
'info',
|
72
|
+
'alias',
|
73
|
+
'mime',
|
74
|
+
'env',
|
75
|
+
'expires',
|
76
|
+
],
|
77
|
+
}
|
78
|
+
apache::vhost { 'defaults.example.com':
|
79
|
+
docroot => '/var/www/defaults',
|
80
|
+
aliases => {
|
81
|
+
alias => '/css',
|
82
|
+
path => '/var/www/css',
|
83
|
+
},
|
84
|
+
setenv => 'TEST1 one',
|
85
|
+
}
|
86
|
+
EOS
|
87
|
+
|
88
|
+
apply_manifest(pp, :catch_failures => true)
|
89
|
+
shell('sleep 10')
|
90
|
+
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
|
91
|
+
end
|
92
|
+
|
93
|
+
describe service(servicename) do
|
94
|
+
it { should be_running }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|