Puppet Class: pxe_install::apache

Defined in:
manifests/apache.pp

Summary

Configure webserver for install server

Overview

Configure the Apache webserver for the install server.

Examples:

include pxe_install::apache

Parameters:

  • kickstart_dir (Stdlib::Unixpath)

    The location where the kickstart/preseed files are stored.

  • kickstart_url (String)

    The URL to access the kickstart/preseed files

  • pub_dir (Stdlib::Unixpath)

    The location where public file like post install scripts are stored.

  • pub_url (String)

    The URL to access the public files.

  • repos_dir (Stdlib::Unixpath)

    The location where package repositories are stores if they are synced.

  • repos_url (String)

    The URL to acces the package repositories.

  • servername (String)

    The server name for the Apache vhost.

  • status_allow_from (Array)

    Array with IPs which are allowed to query the Apache status page.

  • create_aliases (Boolean) (defaults to: true)

    If aliases should be created.

  • ssl_cert (Optional[String]) (defaults to: undef)

    SSL certificate file

  • ssl_key (Optional[String]) (defaults to: undef)

    SSL key corresponding to the cert.

  • ssl_chain (Optional[String]) (defaults to: undef)

    SSL chain file.

  • ssl_certs_dir (Optional[String]) (defaults to: undef)

    Directory where the SSL certs are located.

  • documentroot (Optional[String]) (defaults to: undef)

    The document root directory for the Apache vhost.

  • purge_configs (Boolean) (defaults to: false)

    Boolean to indicate that all Apache configurations not maintained by the Apache Puppet module should be deleted.



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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'manifests/apache.pp', line 55

class pxe_install::apache (
  Stdlib::Unixpath $kickstart_dir,
  String $kickstart_url,
  Stdlib::Unixpath $pub_dir,
  String $pub_url,
  Stdlib::Unixpath $repos_dir,
  String $repos_url,
  String $servername,
  Array $status_allow_from,
  Boolean $create_aliases             = true,
  Boolean $purge_configs              = false,
  Optional[String] $ssl_cert          = undef,
  Optional[String] $ssl_key           = undef,
  Optional[String] $ssl_chain         = undef,
  Optional[String] $ssl_certs_dir     = undef,
  Optional[String] $documentroot      = undef,
) {
  $_ssl_cert = $ssl_cert ? {
    undef   => '',
    default => $ssl_cert,
  }

  $_ssl_key = $ssl_key ? {
    undef   => '',
    default => $ssl_key,
  }

  $_ssl_chain = $ssl_chain ? {
    undef   => '',
    default => $ssl_chain,
  }

  $_ssl_certs_dir = $ssl_certs_dir ? {
    undef   => '',
    default => $ssl_certs_dir,
  }

  $_documentroot = $documentroot ? {
    undef   => '',
    default => $documentroot,
  }

  ensure_resource('file', ['/etc/pki/httpd', "/etc/pki/httpd/${servername}"], {
      ensure => directory,
      owner  => 'root',
      group  => 'root',
      mode   => '0755',
  })

  class { 'apache':
    default_vhost    => false,
    server_tokens    => 'Prod',
    server_signature => 'Off',
    trace_enable     => 'Off',
    purge_configs    => $purge_configs,
  }

  class { 'apache::mod::ssl':
  }

  $_status_allow_from = join($status_allow_from, ' ')
  class { 'apache::mod::status':
    requires => "ip ${_status_allow_from}",
  }

  class { 'apache::mod::info':
    allow_from => $status_allow_from,
  }

  if $create_aliases {
    $aliases = [
      {
        alias => $kickstart_url,
        path  => $kickstart_dir,
      },
      {
        alias => $pub_url,
        path  => $pub_dir,
      },
      {
        alias => $repos_url,
        path  => $repos_dir,
      },
    ]
  } else {
    $aliases = []
  }

  apache::vhost { $servername: #lint:ignore:security_apache_no_ssl_vhost
    port              => 80,
    docroot           => $documentroot,
    servername        => $servername,
    access_log_format => 'combined',
    aliases           => $aliases,
  }

  apache::vhost { "${servername} ssl":
    port                 => 443,
    ssl                  => true,
    ssl_cipher           => '"EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"', #lint:ignore:140chars
    ssl_protocol         => 'TLSv1.2',
    ssl_honorcipherorder => 'on',
    ssl_options          => ['+StdEnvVars'],
    ssl_cert             => $_ssl_cert,
    ssl_key              => $_ssl_key,
    ssl_chain            => $_ssl_chain,
    ssl_certs_dir        => $_ssl_certs_dir,
    docroot              => $documentroot,
    servername           => $servername,
    access_log_format    => 'combined',
    aliases              => $aliases,
  }
}