mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
Relates to SG-11 : Pushes code to repo for Tom to branch from
This commit is contained in:
@@ -1,107 +0,0 @@
|
||||
# = Define: apache::dotconf
|
||||
#
|
||||
# General Apache define to be used to create generic custom .conf files
|
||||
# Very simple wrapper to a normal file type
|
||||
# Use source or template to define the source
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*source*]
|
||||
# Sets the content of source parameter for the dotconf file
|
||||
# If defined, apache dotconf file will have the param: source => $source
|
||||
#
|
||||
# [*template*]
|
||||
# Sets the path to the template to use as content for dotconf file
|
||||
# If defined, apache dotconf file has: content => content("$template")
|
||||
# Note source and template parameters are mutually exclusive: don't use both
|
||||
#
|
||||
# == Usage
|
||||
# apache::dotconf { "sarg": source => 'puppet://$servername/sarg/sarg.conf' }
|
||||
# or
|
||||
# apache::dotconf { "trac": content => template("trac/apache.conf.erb") }
|
||||
#
|
||||
define apache::dotconf (
|
||||
$enable = true,
|
||||
$source = '' ,
|
||||
$content = '' ,
|
||||
$priority = '',
|
||||
$ensure = present,
|
||||
) {
|
||||
|
||||
$manage_file_source = $source ? {
|
||||
'' => undef,
|
||||
default => $source,
|
||||
}
|
||||
|
||||
$manage_file_content = $content ? {
|
||||
'' => undef,
|
||||
default => $content,
|
||||
}
|
||||
|
||||
# Config file path
|
||||
if $priority != '' {
|
||||
$dotconf_path = "${apache::dotconf_dir}/${priority}-${name}.conf"
|
||||
} else {
|
||||
$dotconf_path = "${apache::dotconf_dir}/${name}.conf"
|
||||
}
|
||||
|
||||
# Config file enable path
|
||||
if $priority != '' {
|
||||
$dotconf_enable_path = "${apache::config_dir}/conf-enabled/${priority}-${name}.conf"
|
||||
} else {
|
||||
$dotconf_enable_path = "${apache::config_dir}/conf-enabled/${name}.conf"
|
||||
}
|
||||
|
||||
file { "Apache_${name}.conf":
|
||||
ensure => $ensure,
|
||||
path => $dotconf_path,
|
||||
mode => $apache::config_file_mode,
|
||||
owner => $apache::config_file_owner,
|
||||
group => $apache::config_file_group,
|
||||
require => Package['apache'],
|
||||
notify => $apache::manage_service_autorestart,
|
||||
source => $manage_file_source,
|
||||
content => $manage_file_content,
|
||||
audit => $apache::manage_audit,
|
||||
}
|
||||
|
||||
# Some OS specific settings:
|
||||
# Ubuntu 14 uses conf-available / conf-enabled folders
|
||||
case $::operatingsystem {
|
||||
/(?i:Ubuntu)/ : {
|
||||
case $::lsbmajdistrelease {
|
||||
/14/ : {
|
||||
$dotconf_link_ensure = $enable ? {
|
||||
true => $dotconf_path,
|
||||
false => absent,
|
||||
}
|
||||
|
||||
file { "ApacheDotconfEnabled_${name}":
|
||||
ensure => $dotconf_link_ensure,
|
||||
path => $dotconf_enable_path,
|
||||
require => Package['apache'],
|
||||
}
|
||||
}
|
||||
default: { }
|
||||
}
|
||||
}
|
||||
/(?i:Debian)/ : {
|
||||
case $::lsbmajdistrelease {
|
||||
/8/ : {
|
||||
$dotconf_link_ensure = $enable ? {
|
||||
true => $dotconf_path,
|
||||
false => absent,
|
||||
}
|
||||
|
||||
file { "ApacheDotconfEnabled_${name}":
|
||||
ensure => $dotconf_link_ensure,
|
||||
path => $dotconf_enable_path,
|
||||
require => Package['apache'],
|
||||
}
|
||||
}
|
||||
default: { }
|
||||
}
|
||||
}
|
||||
default: { }
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
# = Define apache::htpasswd
|
||||
#
|
||||
# This define managed apache htpasswd files
|
||||
# Based on CamptoCamp Apache module:
|
||||
# https://github.com/camptocamp/puppet-apache/blob/master/manifests/auth/htpasswd.pp
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*ensure*]
|
||||
# Define if the add (present) or remove the user (set as $name)
|
||||
# Default: 'present',
|
||||
#
|
||||
# [*htpasswd_file*]
|
||||
# Path of the htpasswd file to manage.
|
||||
# Default: "${apache::params::config_dir}/htpasswd"
|
||||
#
|
||||
# [*username*]
|
||||
# Define username when you want to put the username in different files
|
||||
# Default: $name
|
||||
#
|
||||
# [*crypt_password*]
|
||||
# Crypted password (as it appears in htpasswd)
|
||||
# Default: false (either crypt_password or clear_password must be set)
|
||||
#
|
||||
# [*clear_password*]
|
||||
# Clear password (as it appears in htpasswd)
|
||||
# Default: false (either crypt_password or clear_password must be set)
|
||||
#
|
||||
#
|
||||
# == Usage
|
||||
#
|
||||
# Set clear password='mypass' to user 'my_user' on default htpasswd file:
|
||||
# apache::htpasswd { 'myuser':
|
||||
# clear_password => 'my_pass',
|
||||
# }
|
||||
#
|
||||
# Set crypted password to user 'my_user' on custom htpasswd file:
|
||||
# apache::htpasswd { 'myuser':
|
||||
# crypt_password => 'B5dPQYYjf.jjA',
|
||||
# htpasswd_file => '/etc/httpd/users.passwd',
|
||||
# }
|
||||
#
|
||||
# Set the same user in different files
|
||||
# apache::htpasswd { 'myuser':
|
||||
# crypt_password => 'password1',
|
||||
# htpasswd_file => '/etc/httpd/users.passwd'
|
||||
# }
|
||||
#
|
||||
# apache::htpasswd { 'myuser2':
|
||||
# crypt_password => 'password2',
|
||||
# username => 'myuser',
|
||||
# htpasswd_file => '/etc/httpd/httpd.passwd'
|
||||
# }
|
||||
#
|
||||
define apache::htpasswd (
|
||||
$ensure = 'present',
|
||||
$htpasswd_file = '',
|
||||
$username = $name,
|
||||
$crypt_password = false,
|
||||
$clear_password = false ) {
|
||||
|
||||
include apache
|
||||
|
||||
$real_htpasswd_file = $htpasswd_file ? {
|
||||
'' => "${apache::params::config_dir}/htpasswd",
|
||||
default => $htpasswd_file,
|
||||
}
|
||||
|
||||
case $ensure {
|
||||
|
||||
'present': {
|
||||
if $crypt_password and $clear_password {
|
||||
fail 'Choose only one of crypt_password OR clear_password !'
|
||||
}
|
||||
|
||||
if !$crypt_password and !$clear_password {
|
||||
fail 'Choose one of crypt_password OR clear_password !'
|
||||
}
|
||||
|
||||
if $crypt_password {
|
||||
exec { "test -f ${real_htpasswd_file} || OPT='-c'; htpasswd -b \${OPT} ${real_htpasswd_file} ${username} '${crypt_password}'":
|
||||
unless => "grep -q '${username}:${crypt_password}' ${real_htpasswd_file}",
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin',
|
||||
}
|
||||
}
|
||||
|
||||
if $clear_password {
|
||||
exec { "test -f ${real_htpasswd_file} || OPT='-c'; htpasswd -bp \$OPT ${real_htpasswd_file} ${username} ${clear_password}":
|
||||
unless => "egrep '^${username}:' ${real_htpasswd_file} && grep ${username}:\$(mkpasswd -S \$(egrep '^${username}:' ${real_htpasswd_file} |cut -d : -f 2 |cut -c-2) ${clear_password}) ${real_htpasswd_file}",
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
'absent': {
|
||||
exec { "htpasswd -D ${real_htpasswd_file} ${username}":
|
||||
onlyif => "egrep -q '^${username}:' ${real_htpasswd_file}",
|
||||
notify => Exec["delete ${real_htpasswd_file} after remove ${username}"],
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin',
|
||||
}
|
||||
|
||||
exec { "delete ${real_htpasswd_file} after remove ${username}":
|
||||
command => "rm -f ${real_htpasswd_file}",
|
||||
onlyif => "wc -l ${real_htpasswd_file} | egrep -q '^0[^0-9]'",
|
||||
refreshonly => true,
|
||||
path => '/bin:/sbin:/usr/bin:/usr/sbin',
|
||||
}
|
||||
}
|
||||
|
||||
default: { }
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
include apache
|
||||
class{'apache':}
|
||||
@@ -1,139 +0,0 @@
|
||||
# = Define: apache::module
|
||||
#
|
||||
# This define installs and configures apache modules
|
||||
# On Debian and derivatives it places the module config
|
||||
# into /etc/apache/mods-available.
|
||||
# On RedHat and derivatives it just creates the configuration file, if
|
||||
# provided via the templatefile => argument
|
||||
# If you need to customize the module .conf file,
|
||||
# add a templatefile with path to the template,
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*ensure*]
|
||||
# If to enable/install the module. Default: present
|
||||
# Set to absent to disable/remove the module
|
||||
#
|
||||
# [*templatefile*]
|
||||
# Optional. Location of the template to use to configure
|
||||
# the module
|
||||
#
|
||||
# [*install_package*]
|
||||
# If a module package has to be installed. Default: false
|
||||
# Set to true if the module package is not installed by default
|
||||
# and you need to install the relevant package
|
||||
# In this case the package name is calculated according to the operatingsystem
|
||||
# and the ${name} variable.
|
||||
# If the autocalculated package name for the module is not
|
||||
# correct, you can explicitely set it (using a string different than
|
||||
# true or false)
|
||||
#
|
||||
# [*notify_service*]
|
||||
# If you want to restart the apache service automatically when
|
||||
# the module is applied. Default: true
|
||||
#
|
||||
# == Examples
|
||||
# apache::module { 'proxy':
|
||||
# templatefile => 'apache/module/proxy.conf.erb',
|
||||
# }
|
||||
#
|
||||
# apache::module { 'bw':
|
||||
# install_package => true,
|
||||
# templatefile => 'myclass/apache/bw.conf.erb',
|
||||
# }
|
||||
#
|
||||
# apache::module { 'proxy_html':
|
||||
# install_package => 'libapache2-mod-proxy-html',
|
||||
# }
|
||||
#
|
||||
#
|
||||
define apache::module (
|
||||
$ensure = 'present',
|
||||
$templatefile = '',
|
||||
$install_package = false,
|
||||
$notify_service = true ) {
|
||||
|
||||
include apache
|
||||
|
||||
$manage_service_autorestart = $notify_service ? {
|
||||
true => 'Service[apache]',
|
||||
false => undef,
|
||||
}
|
||||
|
||||
if $install_package != false {
|
||||
$modpackage_basename = $::operatingsystem ? {
|
||||
/(?i:Ubuntu|Debian|Mint)/ => 'libapache2-mod-',
|
||||
/(?i:SLES|OpenSuSE)/ => 'apache2-mod_',
|
||||
default => 'mod_',
|
||||
}
|
||||
|
||||
$real_install_package = $install_package ? {
|
||||
true => "${modpackage_basename}${name}",
|
||||
default => $install_package,
|
||||
}
|
||||
|
||||
package { "ApacheModule_${name}":
|
||||
ensure => $ensure,
|
||||
name => $real_install_package,
|
||||
notify => $manage_service_autorestart,
|
||||
require => Package['apache'],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if $templatefile != '' {
|
||||
$module_conf_path = $::operatingsystem ? {
|
||||
/(?i:Ubuntu|Debian|Mint)/ => "${apache::config_dir}/mods-available/${name}.conf",
|
||||
default => "${apache::config_dir}/conf.d/module_${name}.conf",
|
||||
}
|
||||
|
||||
file { "ApacheModule_${name}_conf":
|
||||
ensure => present ,
|
||||
path => $module_conf_path,
|
||||
mode => $apache::config_file_mode,
|
||||
owner => $apache::config_file_owner,
|
||||
group => $apache::config_file_group,
|
||||
content => template($templatefile),
|
||||
notify => $manage_service_autorestart,
|
||||
require => Package['apache'],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if $::operatingsystem == 'Debian'
|
||||
or $::operatingsystem == 'Ubuntu'
|
||||
or $::operatingsystem == 'Mint' {
|
||||
case $ensure {
|
||||
'present': {
|
||||
|
||||
$exec_a2enmod_subscribe = $install_package ? {
|
||||
false => undef,
|
||||
default => Package["ApacheModule_${name}"]
|
||||
}
|
||||
$exec_a2dismode_before = $install_package ? {
|
||||
false => undef,
|
||||
default => Package["ApacheModule_${name}"]
|
||||
}
|
||||
|
||||
exec { "/usr/sbin/a2enmod ${name}":
|
||||
unless => "/bin/sh -c '[ -L ${apache::config_dir}/mods-enabled/${name}.load ] && [ ${apache::config_dir}/mods-enabled/${name}.load -ef ${apache::config_dir}/mods-available/${name}.load ]'",
|
||||
notify => $manage_service_autorestart,
|
||||
require => Package['apache'],
|
||||
subscribe => $exec_a2enmod_subscribe,
|
||||
}
|
||||
}
|
||||
'absent': {
|
||||
exec { "/usr/sbin/a2dismod ${name}":
|
||||
onlyif => "/bin/sh -c '[ -L ${apache::config_dir}/mods-enabled/${name}.load ] && [ ${apache::config_dir}/mods-enabled/${name}.load -ef ${apache::config_dir}/mods-available/${name}.load ]'",
|
||||
notify => $manage_service_autorestart,
|
||||
require => Package['apache'],
|
||||
before => $exec_a2dismode_before,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
# Class apache::passenger
|
||||
#
|
||||
# Apache resources specific for passenger
|
||||
#
|
||||
class apache::passenger {
|
||||
|
||||
include apache
|
||||
|
||||
case $::operatingsystem {
|
||||
ubuntu,debian,mint: {
|
||||
package { 'libapache2-mod-passenger':
|
||||
ensure => present;
|
||||
}
|
||||
|
||||
exec { 'enable-passenger':
|
||||
command => '/usr/sbin/a2enmod passenger',
|
||||
creates => '/etc/apache2/mods-enabled/passenger.load',
|
||||
notify => Service['apache'],
|
||||
require => [
|
||||
Package['apache'],
|
||||
Package['libapache2-mod-passenger']
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
centos,redhat,scientific,fedora: {
|
||||
$osver = split($::operatingsystemrelease, '[.]')
|
||||
|
||||
case $osver[0] {
|
||||
5: { require yum::repo::passenger }
|
||||
default: { }
|
||||
}
|
||||
package { 'mod_passenger':
|
||||
ensure => present;
|
||||
}
|
||||
}
|
||||
|
||||
default: { }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
# Class apache::redhat
|
||||
#
|
||||
# Apache resources specific for RedHat
|
||||
#
|
||||
class apache::redhat {
|
||||
apache::dotconf { '00-NameVirtualHost':
|
||||
content => template('apache/00-NameVirtualHost.conf.erb'),
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
# Class: apache::spec
|
||||
#
|
||||
# This class is used only for rpsec-puppet tests
|
||||
# Can be taken as an example on how to do custom classes but should not
|
||||
# be modified.
|
||||
#
|
||||
# == Usage
|
||||
#
|
||||
# This class is not intended to be used directly.
|
||||
# Use it as reference
|
||||
#
|
||||
class apache::spec inherits apache {
|
||||
|
||||
# This just a test to override the arguments of an existing resource
|
||||
# Note that you can achieve this same result with just:
|
||||
# class { "apache": template => "apache/spec.erb" }
|
||||
|
||||
File['apache.conf'] {
|
||||
content => template('apache/spec.erb'),
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
# = Define: apache::virtualhost
|
||||
#
|
||||
# NOTE: This define does the same function of apache::vhost and is
|
||||
# now deprecated. Use apache::vhost instead.
|
||||
#
|
||||
# Basic Virtual host management define
|
||||
# You can use different templates for your apache virtual host files
|
||||
# Default is virtualhost.conf.erb, adapt it to your needs or create
|
||||
# your custom template.
|
||||
#
|
||||
# == Usage:
|
||||
# With standard template:
|
||||
# apache::virtualhost { "www.example42.com": }
|
||||
#
|
||||
# With custom template (create it in MODULEPATH/apache/templates/virtualhost/)
|
||||
# apache::virtualhost { "webmail.example42.com":
|
||||
# templatefile => "webmail.conf.erb"
|
||||
# }
|
||||
#
|
||||
# With custom template in custom location
|
||||
# (MODULEPATH/mymod/templates/apache/vihost/)
|
||||
# apache::virtualhost { "webmail.example42.com":
|
||||
# templatefile => "webmail.conf.erb"
|
||||
# templatepath => "mymod/apache/vihost"
|
||||
# }
|
||||
#
|
||||
define apache::virtualhost (
|
||||
$templatefile = 'virtualhost.conf.erb' ,
|
||||
$templatepath = 'apache/virtualhost' ,
|
||||
$documentroot = '' ,
|
||||
$filename = '' ,
|
||||
$aliases = '' ,
|
||||
$create_docroot = true ,
|
||||
$enable = true ,
|
||||
$owner = '' ,
|
||||
$content = '' ,
|
||||
$groupowner = '' ) {
|
||||
|
||||
include apache
|
||||
|
||||
$real_filename = $filename ? {
|
||||
'' => $name,
|
||||
default => $filename,
|
||||
}
|
||||
|
||||
$real_documentroot = $documentroot ? {
|
||||
'' => "${apache::data_dir}/${name}",
|
||||
default => $documentroot,
|
||||
}
|
||||
|
||||
$real_owner = $owner ? {
|
||||
'' => $apache::config_file_owner,
|
||||
default => $owner,
|
||||
}
|
||||
|
||||
$real_groupowner = $groupowner ? {
|
||||
'' => $apache::config_file_group,
|
||||
default => $groupowner,
|
||||
}
|
||||
|
||||
$real_path = $::operatingsystem ? {
|
||||
/(?i:Debian|Ubuntu|Mint)/ => "${apache::vdir}/${real_filename}",
|
||||
default => "${apache::vdir}/${real_filename}.conf",
|
||||
}
|
||||
|
||||
$ensure_link = any2bool($enable) ? {
|
||||
true => "${apache::vdir}/${real_filename}",
|
||||
false => absent,
|
||||
}
|
||||
$ensure = bool2ensure($enable)
|
||||
$bool_create_docroot = any2bool($enable) ? {
|
||||
true => any2bool($create_docroot),
|
||||
false => false,
|
||||
}
|
||||
|
||||
$real_content = $content ? {
|
||||
'' => template("${templatepath}/${templatefile}"),
|
||||
default => $content,
|
||||
}
|
||||
|
||||
file { "ApacheVirtualHost_${name}":
|
||||
ensure => $ensure,
|
||||
path => $real_path,
|
||||
content => $real_content,
|
||||
mode => $apache::config_file_mode,
|
||||
owner => $apache::config_file_owner,
|
||||
group => $apache::config_file_group,
|
||||
require => Package['apache'],
|
||||
notify => $apache::manage_service_autorestart,
|
||||
}
|
||||
|
||||
# Some OS specific settings:
|
||||
# On Debian/Ubuntu manages sites-enabled
|
||||
case $::operatingsystem {
|
||||
ubuntu,debian,mint: {
|
||||
file { "ApacheVirtualHostEnabled_${name}":
|
||||
ensure => $ensure_link,
|
||||
path => "${apache::config_dir}/sites-enabled/${real_filename}",
|
||||
require => Package['apache'],
|
||||
}
|
||||
}
|
||||
redhat,centos,scientific,fedora: {
|
||||
include apache::redhat
|
||||
}
|
||||
default: { }
|
||||
}
|
||||
|
||||
if $bool_create_docroot == true {
|
||||
file { $real_documentroot:
|
||||
ensure => directory,
|
||||
owner => $real_owner,
|
||||
group => $real_groupowner,
|
||||
mode => '0775',
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
require "#{File.join(File.dirname(__FILE__),'..','spec_helper.rb')}"
|
||||
|
||||
describe 'apache::virtualhost' do
|
||||
|
||||
let(:title) { 'apache::virtualhost' }
|
||||
let(:node) { 'rspec.example42.com' }
|
||||
let(:facts) { { :arch => 'i386' , :operatingsystem => 'redhat' } }
|
||||
let(:params) {
|
||||
{ 'enable' => 'true',
|
||||
'name' => 'www.example42.com',
|
||||
'documentroot' => '/store/www',
|
||||
}
|
||||
}
|
||||
|
||||
describe 'Test apache::virtualhost on redhat' do
|
||||
it 'should create a apache::virtualhost file' do
|
||||
should contain_file('ApacheVirtualHost_www.example42.com').with_ensure('present')
|
||||
end
|
||||
it 'should populate correctly the apache::virtualhost file DocumentRoot' do
|
||||
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ DocumentRoot \/store\/www/)
|
||||
end
|
||||
it 'should populate correctly the apache::virtualhost file ErrorLog' do
|
||||
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ ErrorLog \/var\/log\/httpd\/www.example42.com-error_log/)
|
||||
end
|
||||
it 'should create the docroot directory' do
|
||||
should contain_file('/store/www').with_ensure("directory")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'Test apache::virtualhost on ubuntu' do
|
||||
let(:facts) { { :arch => 'i386' , :operatingsystem => 'ubuntu' } }
|
||||
let(:params) {
|
||||
{ 'enable' => 'true',
|
||||
'name' => 'www.example42.com',
|
||||
}
|
||||
}
|
||||
|
||||
it 'should create a apache::virtualhost link in sites-enabled' do
|
||||
should contain_file('ApacheVirtualHostEnabled_www.example42.com').with_ensure('/etc/apache2/sites-available/www.example42.com')
|
||||
end
|
||||
it 'should populate correctly the apache::virtualhost file DocumentRoot' do
|
||||
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ DocumentRoot \/var\/www\/www.example42.com/)
|
||||
end
|
||||
it 'should populate correctly the apache::virtualhost file ErrorLog' do
|
||||
should contain_file('ApacheVirtualHost_www.example42.com').with_content(/ ErrorLog \/var\/log\/apache2\/www.example42.com-error_log/)
|
||||
end
|
||||
it 'should create the docroot directory' do
|
||||
should contain_file('/var/www/www.example42.com').with_ensure("directory")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'Test apache::virtualhost decommissioning' do
|
||||
let(:params) {
|
||||
{ 'enable' => 'false',
|
||||
'name' => 'www.example42.com',
|
||||
'documentroot' => '/var/www/example42.com',
|
||||
}
|
||||
}
|
||||
|
||||
it { should contain_file('ApacheVirtualHost_www.example42.com').with_ensure('absent') }
|
||||
it { should_not contain_file('/var/www/example42.com').with_ensure('directory') }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# File managed by Puppet
|
||||
|
||||
NameVirtualHost *:80
|
||||
@@ -1,6 +0,0 @@
|
||||
# File Handled by Puppet
|
||||
|
||||
<% if @namevirtualhost -%>
|
||||
NameVirtualHost <%= @namevirtualhost %>:<%= @name %>
|
||||
<% end %>
|
||||
Listen <%= @name %>
|
||||
@@ -1,17 +0,0 @@
|
||||
# File Managed by Puppet
|
||||
|
||||
<IfModule mod_proxy.c>
|
||||
|
||||
# This is not a forwared proxy
|
||||
ProxyRequests Off
|
||||
|
||||
<Proxy *>
|
||||
AddDefaultCharset off
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from all
|
||||
</Proxy>
|
||||
|
||||
ProxyVia On
|
||||
|
||||
</IfModule>
|
||||
@@ -1,8 +0,0 @@
|
||||
# This is a template used only for rspec tests
|
||||
|
||||
# Yaml of the whole scope
|
||||
<%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>
|
||||
|
||||
# Custom Options
|
||||
<%= @options['opt_a'] %>
|
||||
<%= @options['opt_b'] %>
|
||||
@@ -1,77 +0,0 @@
|
||||
# File Managed by Puppet
|
||||
|
||||
<VirtualHost <%= @ip_addr %>:<%= @port %>>
|
||||
ServerAdmin <%= @server_admin_email ||= 'webmaster@localhost' %>
|
||||
DocumentRoot <%= @real_docroot %>
|
||||
<% if @server_name_value != false -%>
|
||||
ServerName <%= @server_name_value %>
|
||||
<% end -%>
|
||||
<% if @serveraliases != "" -%>
|
||||
<% if @serveraliases.is_a? Array -%>
|
||||
ServerAlias <%= @serveraliases.flatten.join(" ") %>
|
||||
<% else -%>
|
||||
ServerAlias <%= @serveraliases %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if @env_variables != "" -%>
|
||||
<% if @env_variables.is_a? Array -%>
|
||||
<% @env_variables.each do |envvars| -%>
|
||||
SetEnv <%= envvars %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
ErrorLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-error_log
|
||||
CustomLog <%= scope.lookupvar('apache::log_dir') %>/<%= @name %>-access_log common
|
||||
|
||||
<% if @bool_passenger -%>
|
||||
PassengerHighPerformance <%= @bool_passenger_high_performance ? "On" : "Off" %>
|
||||
PassengerMaxPoolSize <%= @passenger_max_pool_size %>
|
||||
PassengerPoolIdleTime <%= @passenger_pool_idle_time %>
|
||||
PassengerMaxRequests <%= @passenger_max_requests %>
|
||||
PassengerStatThrottleRate <%= @passenger_stat_throttle_rate %>
|
||||
RackAutoDetect <%= @bool_passenger_rack_auto_detect ? "On" : "Off" %>
|
||||
RailsAutoDetect <%= @bool_passenger_rails_auto_detect ? "On" : "Off" %>
|
||||
|
||||
<% if @passenger_rails_env != '' %>RailsEnv <%= @passenger_rails_env %><% end %>
|
||||
<% if @passenger_rack_env != '' %>RackEnv <%= @passenger_rack_env %><% end %>
|
||||
<% if @passenger_rails_base_uri != '' %>RailsBaseURI <%= @passenger_rails_base_uri %><% end %>
|
||||
<% if @passenger_rack_base_uri != '' %>RackBaseURI <%= @passenger_rack_base_uri %><% end %>
|
||||
|
||||
<% end -%>
|
||||
<% if @directory_options != "" || @directory_allow_override != "None" || @directory_require != "" -%>
|
||||
<Directory <%= @real_directory %>>
|
||||
<% if @directory_options != "" -%>
|
||||
Options <%= @directory_options %>
|
||||
<% end -%>
|
||||
<% if @directory_allow_override != "None" -%>
|
||||
AllowOverride <%= @directory_allow_override %>
|
||||
<% end -%>
|
||||
<% if @directory_require != "" -%>
|
||||
Require <%= @directory_require %>
|
||||
<% end -%>
|
||||
</Directory>
|
||||
<% end -%>
|
||||
|
||||
<% if @aliases != "" -%>
|
||||
<% if @aliases.is_a? Array -%>
|
||||
<% @aliases.each do |singlealias| %>
|
||||
Alias <%= singlealias %>
|
||||
<% end -%>
|
||||
<% else -%>
|
||||
Alias <%= @aliases %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% if @proxy_aliases != "" -%>
|
||||
<% if @proxy_aliases.is_a? Array -%>
|
||||
<% @proxy_aliases.each do |singleproxyalias| %>
|
||||
|
||||
ProxyPass <%= singleproxyalias %>
|
||||
ProxyPassReverse <%= singleproxyalias %>
|
||||
<% end -%>
|
||||
<% else -%>
|
||||
ProxyPass <%= @proxy_aliases %>
|
||||
ProxyPassReverse <%= @proxy_aliases %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
</VirtualHost>
|
||||
@@ -1,16 +0,0 @@
|
||||
# File Managed by Puppet
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@<%= @name %>
|
||||
DocumentRoot <%= @real_documentroot %>
|
||||
ServerName <%= @name %>
|
||||
<% if @aliases != "" -%>
|
||||
<% if @aliases.is_a? Array -%>
|
||||
ServerAlias <%= @aliases.flatten.join(" ") %>
|
||||
<% else -%>
|
||||
ServerAlias <%= @aliases %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
ErrorLog <%= scope.lookupvar('apache::log_dir')%>/<%= @name %>-error_log
|
||||
CustomLog <%= scope.lookupvar('apache::log_dir')%>/<%= @name %>-access_log common
|
||||
</VirtualHost>
|
||||
@@ -1,7 +0,0 @@
|
||||
include apache
|
||||
|
||||
apache::vhost { 'testsite':
|
||||
docroot => '/var/www/test',
|
||||
env_variables => ['APP_ENV dev'],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user