Saltstack Official Nginx Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

map.jinja 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. {% macro sls_block(dict) %}
  2. {% for key, value in dict.items() %}
  3. - {{ key }}: {{ value|json() }}
  4. {% endfor %}
  5. {% endmacro %}
  6. {% set nginx = salt['pillar.get']('nginx:ng', {
  7. 'lookup': salt['grains.filter_by']({
  8. 'Debian': {
  9. 'package': 'nginx',
  10. 'passenger_package': 'passenger',
  11. 'service': 'nginx',
  12. 'webuser': 'www-data',
  13. 'conf_file': '/etc/nginx/nginx.conf',
  14. 'server_available': '/etc/nginx/sites-available',
  15. 'server_enabled': '/etc/nginx/sites-enabled',
  16. 'server_use_symlink': True,
  17. 'pid_file': '/run/nginx.pid',
  18. },
  19. 'CentOS': {
  20. 'package': 'nginx',
  21. 'passenger_package': 'passenger',
  22. 'service': 'nginx',
  23. 'webuser': 'nginx',
  24. 'conf_file': '/etc/nginx/nginx.conf',
  25. 'server_available': '/etc/nginx/conf.d',
  26. 'server_enabled': '/etc/nginx/conf.d',
  27. 'server_use_symlink': False,
  28. 'pid_file': '/run/nginx.pid',
  29. 'rh_os_releasever': '$releasever',
  30. 'gpg_check': False,
  31. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  32. },
  33. 'RedHat': {
  34. 'package': 'nginx',
  35. 'passenger_package': 'passenger',
  36. 'service': 'nginx',
  37. 'webuser': 'nginx',
  38. 'conf_file': '/etc/nginx/nginx.conf',
  39. 'server_available': '/etc/nginx/conf.d',
  40. 'server_enabled': '/etc/nginx/conf.d',
  41. 'server_use_symlink': False,
  42. 'pid_file': '/run/nginx.pid',
  43. 'rh_os_releasever': '$releasever',
  44. 'gpg_check': False,
  45. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  46. 'passenger': {
  47. 'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
  48. 'passenger_instance_registry_dir': ' /var/run/passenger-instreg',
  49. 'passenger_ruby': '/usr/bin/ruby',
  50. },
  51. },
  52. 'Suse': {
  53. 'package': 'nginx',
  54. 'service': 'nginx',
  55. 'webuser': 'nginx',
  56. 'conf_file': '/etc/nginx/nginx.conf',
  57. 'server_available': '/etc/nginx/conf.d',
  58. 'server_enabled': '/etc/nginx/conf.d',
  59. 'server_use_symlink': False,
  60. 'pid_file': '/run/nginx.pid',
  61. 'gpg_check': True,
  62. 'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key'
  63. },
  64. 'Arch': {
  65. 'package': 'nginx',
  66. 'service': 'nginx',
  67. 'webuser': 'http',
  68. 'conf_file': '/etc/nginx/nginx.conf',
  69. 'server_available': '/etc/nginx/sites-available',
  70. 'server_enabled': '/etc/nginx/sites-enabled',
  71. 'server_use_symlink': True,
  72. },
  73. 'Gentoo': {
  74. 'package': 'www-servers/nginx',
  75. 'service': 'nginx',
  76. 'webuser': 'nginx',
  77. 'conf_file': '/etc/nginx/nginx.conf',
  78. 'server_available': '/etc/nginx/sites-available',
  79. 'server_enabled': '/etc/nginx/sites-enabled',
  80. 'server_use_symlink': True,
  81. },
  82. }, default='Debian' ),
  83. 'install_from_source': False,
  84. 'install_from_ppa': False,
  85. 'install_from_repo': False,
  86. 'install_from_phusionpassenger': False,
  87. 'ppa_version': 'stable',
  88. 'source_version': '1.10.0',
  89. 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
  90. 'source': {
  91. 'opts': {},
  92. },
  93. 'package': {
  94. 'opts': {},
  95. },
  96. 'service': {
  97. 'enable': True,
  98. 'opts': {},
  99. },
  100. 'server': {
  101. 'opts': {},
  102. 'config': {
  103. 'worker_processes': 4,
  104. 'events': {
  105. 'worker_connections': 768,
  106. },
  107. 'http': {
  108. 'sendfile': 'on',
  109. 'tcp_nopush': 'on',
  110. 'tcp_nodelay': 'on',
  111. 'keepalive_timeout': '65',
  112. 'types_hash_max_size': '2048',
  113. 'default_type': 'application/octet-stream',
  114. 'access_log': '/var/log/nginx/access.log',
  115. 'error_log': '/var/log/nginx/error.log',
  116. 'gzip': 'off',
  117. 'gzip_disable': '"msie6"',
  118. 'include': [
  119. '/etc/nginx/mime.types',
  120. '/etc/nginx/conf.d/*.conf',
  121. '/etc/nginx/sites-enabled/*',
  122. ],
  123. },
  124. },
  125. },
  126. 'servers': {
  127. 'disabled_postfix': '.disabled',
  128. 'symlink_opts': {},
  129. 'rename_opts': {},
  130. 'managed_opts': {},
  131. 'dir_opts': {
  132. 'makedirs': True,
  133. },
  134. 'managed': {},
  135. },
  136. 'passenger': {
  137. 'passenger_root': '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini',
  138. 'passenger_ruby': '/usr/bin/ruby',
  139. },
  140. }, merge=True) %}
  141. {% if 'user' not in nginx.server.config %}
  142. {% do nginx.server.config.update({
  143. 'user': nginx.lookup.webuser,
  144. })%}
  145. {% endif %}
  146. {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
  147. {% do nginx.server.config.update({
  148. 'pid': nginx.lookup.pid_file,
  149. })%}
  150. {% endif %}
  151. {% if salt['grains.get']('os_family') == 'RedHat' %}
  152. {% do nginx.passenger.update({
  153. 'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
  154. 'passenger_instance_registry_dir': '/var/run/passenger-instreg',
  155. })%}
  156. {% if salt['grains.get']('osfinger') == 'CentOS-6' %}
  157. {% do nginx.server.config.update({
  158. 'pid': '/var/run/nginx.pid',
  159. })%}
  160. {% do nginx.passenger.update({
  161. 'passenger_root': '/usr/lib/ruby/1.8/phusion_passenger/locations.ini',
  162. })%}
  163. {% endif %}
  164. {% endif %}