This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathinstall.pp
86 lines (70 loc) · 2.95 KB
/
install.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class puphpet::apache::install
inherits puphpet::apache::params
{
include ::apache::params
$apache = $puphpet::params::hiera['apache']
if ! defined(Puphpet::Firewall::Port['80']) {
::puphpet::firewall::port { '80': }
}
if ! defined(Puphpet::Firewall::Port['443']) {
::puphpet::firewall::port { '443': }
}
$www_root = $puphpet::apache::params::www_root
$webroot_group = $puphpet::apache::params::webroot_group
# centos 2.4 installation creates webroot automatically,
# requiring us to manually set owner and permissions via exec
exec { 'Create apache webroot':
command => "mkdir -p ${www_root} && \
chown root:${webroot_group} ${www_root} && \
chmod 775 ${www_root} && \
touch ${puphpet::params::puphpet_state_dir}/apache-webroot-created",
creates => "${puphpet::params::puphpet_state_dir}/apache-webroot-created",
require => [
Group[$webroot_group],
Class['apache']
],
}
$index_file = "${puphpet::apache::params::default_vhost_dir}/index.html"
$source_file = "${puphpet::params::puphpet_manifest_dir}/files/webserver_landing.html"
exec { "Set ${index_file} contents":
command => "cat ${source_file} > ${index_file} && \
chmod 644 ${index_file} && \
chown root ${index_file} && \
chgrp ${puphpet::apache::params::webroot_group} ${index_file} && \
touch ${puphpet::params::puphpet_state_dir}/default_vhost_index_file_set",
returns => [0, 1],
creates => "${puphpet::params::puphpet_state_dir}/default_vhost_index_file_set",
require => Exec['Create apache webroot'],
}
if $::osfamily == 'debian' {
file { $puphpet::apache::params::ssl_mutex_dir:
ensure => directory,
group => $puphpet::apache::params::webroot_group,
mode => '0775',
require => Class['apache'],
notify => Service[$::apache::params::service_name],
}
}
include ::puphpet::apache::repo
$version = array_true($puphpet::params::hiera['apache']['settings'], 'version') ? {
true => $puphpet::params::hiera['apache']['settings']['version'],
default => $puphpet::apache::params::package_version,
}
$version_true = ($version in [2.4, 24, '24', '2.4']) ? {
true => 'present',
default => $version
}
$settings = delete(merge($puphpet::params::hiera['apache']['settings'], {
'apache_name' => $puphpet::apache::params::package_name,
'default_vhost' => false,
'mpm_module' => 'worker',
'conf_template' => $::apache::params::conf_template,
'sendfile' => $puphpet::apache::params::sendfile,
'apache_version' => $puphpet::apache::params::package_version,
'package_ensure' => $version_true,
}), 'version')
create_resources('class', { 'apache' => $settings })
puphpet::apache::modules { 'from puphpet::apache::install': }
include ::puphpet::apache::ssl::snakeoil
puphpet::apache::vhosts { 'from puphpet::apache::install': }
}