Saltstack Official Nginx Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

142 lines
4.5KB

  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. 'service': 'nginx',
  11. 'webuser': 'www-data',
  12. 'conf_file': '/etc/nginx/nginx.conf',
  13. 'server_available': '/etc/nginx/sites-available',
  14. 'server_enabled': '/etc/nginx/sites-enabled',
  15. 'server_use_symlink': True,
  16. 'pid_file': '/run/nginx.pid',
  17. },
  18. 'CentOS': {
  19. 'package': 'nginx',
  20. 'service': 'nginx',
  21. 'webuser': 'nginx',
  22. 'conf_file': '/etc/nginx/nginx.conf',
  23. 'server_available': '/etc/nginx/conf.d',
  24. 'server_enabled': '/etc/nginx/conf.d',
  25. 'server_use_symlink': False,
  26. 'pid_file': '/run/nginx.pid',
  27. 'rh_os_releasever': '$releasever',
  28. 'gpg_check': False,
  29. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  30. },
  31. 'RedHat': {
  32. 'package': 'nginx',
  33. 'service': 'nginx',
  34. 'webuser': 'nginx',
  35. 'conf_file': '/etc/nginx/nginx.conf',
  36. 'server_available': '/etc/nginx/conf.d',
  37. 'server_enabled': '/etc/nginx/conf.d',
  38. 'server_use_symlink': False,
  39. 'pid_file': '/run/nginx.pid',
  40. 'rh_os_releasever': '$releasever',
  41. 'gpg_check': False,
  42. 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
  43. },
  44. 'Suse': {
  45. 'package': 'nginx',
  46. 'service': 'nginx',
  47. 'webuser': 'nginx',
  48. 'conf_file': '/etc/nginx/nginx.conf',
  49. 'server_available': '/etc/nginx/conf.d',
  50. 'server_enabled': '/etc/nginx/conf.d',
  51. 'server_use_symlink': False,
  52. 'pid_file': '/run/nginx.pid',
  53. 'gpg_check': True,
  54. 'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key'
  55. },
  56. 'Arch': {
  57. 'package': 'nginx',
  58. 'service': 'nginx',
  59. 'webuser': 'http',
  60. 'conf_file': '/etc/nginx/nginx.conf',
  61. 'server_available': '/etc/nginx/sites-available',
  62. 'server_enabled': '/etc/nginx/sites-enabled',
  63. 'server_use_symlink': True,
  64. },
  65. 'Gentoo': {
  66. 'package': 'www-servers/nginx',
  67. 'service': 'nginx',
  68. 'webuser': 'nginx',
  69. 'conf_file': '/etc/nginx/nginx.conf',
  70. 'server_available': '/etc/nginx/sites-available',
  71. 'server_enabled': '/etc/nginx/sites-enabled',
  72. 'server_use_symlink': True,
  73. },
  74. }, default='Debian' ),
  75. 'install_from_source': False,
  76. 'install_from_ppa': False,
  77. 'install_from_repo': False,
  78. 'ppa_version': 'stable',
  79. 'source_version': '1.10.0',
  80. 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
  81. 'source': {
  82. 'opts': {},
  83. },
  84. 'package': {
  85. 'opts': {},
  86. },
  87. 'service': {
  88. 'enable': True,
  89. 'opts': {},
  90. },
  91. 'server': {
  92. 'opts': {},
  93. 'config': {
  94. 'worker_processes': 4,
  95. 'events': {
  96. 'worker_connections': 768,
  97. },
  98. 'http': {
  99. 'sendfile': 'on',
  100. 'tcp_nopush': 'on',
  101. 'tcp_nodelay': 'on',
  102. 'keepalive_timeout': '65',
  103. 'types_hash_max_size': '2048',
  104. 'default_type': 'application/octet-stream',
  105. 'access_log': '/var/log/nginx/access.log',
  106. 'error_log': '/var/log/nginx/error.log',
  107. 'gzip': 'off',
  108. 'gzip_disable': '"msie6"',
  109. 'include': [
  110. '/etc/nginx/mime.types',
  111. '/etc/nginx/conf.d/*.conf',
  112. '/etc/nginx/sites-enabled/*',
  113. ],
  114. },
  115. },
  116. },
  117. 'servers': {
  118. 'disabled_postfix': '.disabled',
  119. 'symlink_opts': {},
  120. 'rename_opts': {},
  121. 'managed_opts': {},
  122. 'dir_opts': {
  123. 'makedirs': True,
  124. },
  125. 'managed': {},
  126. },
  127. }, merge=True) %}
  128. {% if 'user' not in nginx.server.config %}
  129. {% do nginx.server.config.update({
  130. 'user': nginx.lookup.webuser,
  131. })%}
  132. {% endif %}
  133. {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
  134. {% do nginx.server.config.update({
  135. 'pid': nginx.lookup.pid_file,
  136. })%}
  137. {% endif %}