Puppet Class: lsys::httpd

Defined in:
manifests/httpd.pp

Summary

Apache Web server installation and basic configuration

Overview

Apache Web server installation and basic configuration

Examples:

include lsys::httpd

Parameters:

  • listen_port (Stdlib::Port) (defaults to: 80)
  • servername (String) (defaults to: 'localhost')
  • manage_group (Boolean) (defaults to: true)
  • manage_user (Boolean) (defaults to: true)
  • enable (Boolean) (defaults to: true)


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
87
88
89
90
91
92
93
94
95
96
# File 'manifests/httpd.pp', line 7

class lsys::httpd (
  Stdlib::Port $listen_port = 80,
  String $servername = 'localhost',
  Boolean $manage_group = true,
  Boolean $manage_user = true,
  Boolean $enable = true,
) {
  if $enable {
    $service_ensure = 'running'
    $service_enable = true
  }
  else {
    $service_ensure = 'stopped'
    $service_enable = false
  }

  $docroot = '/var/www/html'

  class { 'apache':
    mpm_module             => false,
    default_mods           => [],
    use_systemd            => true,
    default_vhost          => false,
    default_ssl_vhost      => false,
    server_signature       => 'Off',
    trace_enable           => 'Off',
    servername             => $servername,
    timeout                => 60,
    keepalive              => 'On',
    max_keepalive_requests => 100,
    keepalive_timeout      => 5,
    root_directory_secured => true,
    docroot                => $docroot,
    default_charset        => 'UTF-8',
    conf_template          => 'lsys/httpd.conf.epp',
    mime_types_additional  => undef,
    service_manage         => true,
    service_ensure         => $service_ensure,
    service_enable         => $service_enable,
    manage_group           => $manage_group,
    manage_user            => $manage_user,
  }

  apache::custom_config { 'docroot':
    content  => epp('lsys/httpd-docroot.conf.epp', {
        'docroot' => $docroot,
    }),
    priority => '00',
  }

  class { 'apache::mod::prefork':
    startservers        => 5,
    minspareservers     => 5,
    maxspareservers     => 10,
    serverlimit         => 256,
    maxclients          => 256,
    maxrequestsperchild => 0,
    notify              => Class['Apache::Service'],
  }

  apache::listen { "${listen_port}": # lint:ignore:only_variable_string
    notify  => Class['Apache::Service'],
  }

  # apache::mod::mime included by SSL module
  class { 'apache::mod::ssl':
    ssl_compression            => false,
    ssl_cipher                 => 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256', # lint:ignore:140chars
    ssl_protocol               => ['all', '-SSLv3', '-TLSv1', '-TLSv1.1'],
    ssl_random_seed_bytes      => 1024,
    ssl_mutex                  => 'default',
    ssl_stapling               => true,
    ssl_stapling_return_errors => false,
    notify                     => Class['Apache::Service'],
  }

  class { 'apache::mod::dir':
    indexes => ['index.html'],
    notify  => Class['Apache::Service'],
  }

  class { 'apache::mod::mime_magic':
    magic_file => 'conf/magic',
    notify     => Class['Apache::Service'],
  }

  include apache::mod::headers
  include apache::mod::rewrite
  include apache::mod::alias
}