apache_placement.pp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #
  2. # Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
  3. #
  4. # Author: Emilien Macchi <emilien.macchi@enovance.com>
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  7. # not use this file except in compliance with the License. You may obtain
  8. # a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. # License for the specific language governing permissions and limitations
  16. # under the License.
  17. #
  18. # Class to serve Nova Placement API service.
  19. # Serving Nova Placement API from apache is the recommended way to go for production
  20. # because of limited performance for concurrent accesses.
  21. #
  22. # == Parameters
  23. #
  24. # [*servername*]
  25. # The servername for the virtualhost.
  26. # Optional. Defaults to $::fqdn
  27. #
  28. # [*api_port*]
  29. # The port for Novai Placement API service.
  30. # Optional. Defaults to 80
  31. #
  32. # [*bind_host*]
  33. # The host/ip address Apache will listen on.
  34. # Optional. Defaults to undef (listen on all ip addresses).
  35. #
  36. # [*path*]
  37. # The prefix for the endpoint.
  38. # Optional. Defaults to '/placement'
  39. #
  40. # [*ssl*]
  41. # Use ssl ? (boolean)
  42. # Optional. Defaults to true
  43. #
  44. # [*workers*]
  45. # Number of WSGI workers to spawn.
  46. # Optional. Defaults to 1
  47. #
  48. # [*priority*]
  49. # (optional) The priority for the vhost.
  50. # Defaults to '10'
  51. #
  52. # [*threads*]
  53. # (optional) The number of threads for the vhost.
  54. # Defaults to $::os_workers
  55. #
  56. # [*wsgi_process_display_name*]
  57. # (optional) Name of the WSGI process display-name.
  58. # Defaults to undef
  59. #
  60. # [*ensure_package*]
  61. # (optional) Control the ensure parameter for the Nova Placement API package ressource.
  62. # Defaults to 'present'
  63. #
  64. # [*ssl_cert*]
  65. # [*ssl_key*]
  66. # [*ssl_chain*]
  67. # [*ssl_ca*]
  68. # [*ssl_crl_path*]
  69. # [*ssl_crl*]
  70. # [*ssl_certs_dir*]
  71. # apache::vhost ssl parameters.
  72. # Optional. Default to apache::vhost 'ssl_*' defaults.
  73. #
  74. # == Examples
  75. #
  76. # include apache
  77. #
  78. # class { 'nova::wsgi::apache': }
  79. #
  80. class nova::wsgi::apache_placement (
  81. $servername = $::fqdn,
  82. $api_port = 80,
  83. $bind_host = undef,
  84. $path = '/placement',
  85. $ssl = true,
  86. $workers = 1,
  87. $ssl_cert = undef,
  88. $ssl_key = undef,
  89. $ssl_chain = undef,
  90. $ssl_ca = undef,
  91. $ssl_crl_path = undef,
  92. $ssl_crl = undef,
  93. $ssl_certs_dir = undef,
  94. $wsgi_process_display_name = undef,
  95. $threads = $::os_workers,
  96. $priority = '10',
  97. $ensure_package = 'present',
  98. ) {
  99. include ::nova::params
  100. include ::apache
  101. include ::apache::mod::wsgi
  102. if $ssl {
  103. include ::apache::mod::ssl
  104. }
  105. nova::generic_service { 'placement-api':
  106. service_name => false,
  107. package_name => $::nova::params::placement_package_name,
  108. ensure_package => $ensure_package,
  109. }
  110. # Ubuntu requires nova-placement-api to be installed before apache to find wsgi script
  111. Package<| title == 'nova-placement-api'|> -> Package<| title == 'httpd'|>
  112. ::openstacklib::wsgi::apache { 'placement_wsgi':
  113. bind_host => $bind_host,
  114. bind_port => $api_port,
  115. group => 'nova',
  116. path => $path,
  117. priority => $priority,
  118. servername => $servername,
  119. ssl => $ssl,
  120. ssl_ca => $ssl_ca,
  121. ssl_cert => $ssl_cert,
  122. ssl_certs_dir => $ssl_certs_dir,
  123. ssl_chain => $ssl_chain,
  124. ssl_crl => $ssl_crl,
  125. ssl_crl_path => $ssl_crl_path,
  126. ssl_key => $ssl_key,
  127. threads => $threads,
  128. user => 'nova',
  129. workers => $workers,
  130. wsgi_daemon_process => 'placement-api',
  131. wsgi_process_display_name => $wsgi_process_display_name,
  132. wsgi_process_group => 'placement-api',
  133. wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
  134. wsgi_script_file => 'nova-placement-api',
  135. wsgi_script_source => $::nova::params::placement_wsgi_script_source,
  136. }
  137. }