Puppet Class: apache::mod::wsgi

Inherits:
apache::params
Defined in:
manifests/mod/wsgi.pp

Summary

Installs and configures `mod_wsgi`.

Overview

Note:

Unsupported platforms: SLES: all; RedHat: all; CentOS: all; OracleLinux: all; Scientific: all

Parameters:

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

    Enable restrictions on use of embedded mode.

  • wsgi_socket_prefix (Optional[String]) (defaults to: $apache::params::wsgi_socket_prefix)

    Configure directory to use for daemon sockets.

  • wsgi_python_path (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Additional directories to search for Python modules.

  • wsgi_python_home (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Absolute path to Python prefix/exec_prefix directories.

  • wsgi_python_optimize (Optional[Integer]) (defaults to: undef)

    Enables basic Python optimisation features.

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

    Sets which application group WSGI application belongs to.

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

    Names of package that installs mod_wsgi.

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

    Defines the path to the mod_wsgi shared object (.so) file.

See Also:



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
# File 'manifests/mod/wsgi.pp', line 30

class apache::mod::wsgi (
  Optional[String] $wsgi_restrict_embedded         = undef,
  Optional[String] $wsgi_socket_prefix             = $apache::params::wsgi_socket_prefix,
  Optional[Stdlib::Absolutepath] $wsgi_python_path = undef,
  Optional[Stdlib::Absolutepath] $wsgi_python_home = undef,
  Optional[Integer] $wsgi_python_optimize          = undef,
  Optional[String] $wsgi_application_group         = undef,
  Optional[String] $package_name                   = undef,
  Optional[String] $mod_path                       = undef,
) inherits apache::params {
  include apache
  if ($package_name != undef and $mod_path == undef) or ($package_name == undef and $mod_path != undef) {
    fail('apache::mod::wsgi - both package_name and mod_path must be specified!')
  }

  if $package_name != undef {
    if $mod_path =~ /\// {
      $_mod_path = $mod_path
    } else {
      $_mod_path = "${apache::lib_path}/${mod_path}"
    }
    ::apache::mod { 'wsgi':
      package => $package_name,
      path    => $_mod_path,
    }
  }
  else {
    ::apache::mod { 'wsgi': }
  }

  # Template uses:
  # - $wsgi_restrict_embedded
  # - $wsgi_socket_prefix
  # - $wsgi_python_path
  # - $wsgi_python_home
  $parameters = {
    'wsgi_restrict_embedded'  => $wsgi_restrict_embedded,
    'wsgi_socket_prefix'      => $wsgi_socket_prefix,
    'wsgi_python_home'        => $wsgi_python_home,
    'wsgi_python_path'        => $wsgi_python_path,
    'wsgi_application_group'  => $wsgi_application_group,
    'wsgi_python_optimize'    => $wsgi_python_optimize,
  }

  file { 'wsgi.conf':
    ensure  => file,
    path    => "${apache::mod_dir}/wsgi.conf",
    mode    => $apache::file_mode,
    content => epp('apache/mod/wsgi.conf.epp', $parameters),
    require => Exec["mkdir ${apache::mod_dir}"],
    before  => File[$apache::mod_dir],
    notify  => Class['apache::service'],
  }
}