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ů.

114 lines
3.4KB

  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. 'vhost_available': '/etc/nginx/sites-available',
  14. 'vhost_enabled': '/etc/nginx/sites-enabled',
  15. 'vhost_use_symlink': True,
  16. 'pid_file': '/run/nginx.pid',
  17. },
  18. 'RedHat': {
  19. 'package': 'nginx',
  20. 'service': 'nginx',
  21. 'webuser': 'nginx',
  22. 'conf_file': '/etc/nginx/nginx.conf',
  23. 'vhost_available': '/etc/nginx/conf.d',
  24. 'vhost_enabled': '/etc/nginx/conf.d',
  25. 'vhost_use_symlink': False,
  26. <<<<<<< HEAD
  27. 'pid_file': '/var/run/nginx.pid',
  28. =======
  29. >>>>>>> * added pillar variable to specify os release version for nginx package repo base url for RedHat family os hosts
  30. 'rh_os_releasever': '$releasever',
  31. },
  32. 'Suse': {
  33. 'package': 'nginx',
  34. 'service': 'nginx',
  35. 'webuser': 'nginx',
  36. 'conf_file': '/etc/nginx/nginx.conf',
  37. 'vhost_available': '/etc/nginx/conf.d',
  38. 'vhost_enabled': '/etc/nginx/conf.d',
  39. 'vhost_use_symlink': False,
  40. 'pid_file': '/run/nginx.pid',
  41. },
  42. 'Arch': {
  43. 'package': 'nginx',
  44. 'service': 'nginx',
  45. 'webuser': 'http',
  46. 'conf_file': '/etc/nginx/nginx.conf',
  47. 'vhost_available': '/etc/nginx/sites-available',
  48. 'vhost_enabled': '/etc/nginx/sites-enabled',
  49. 'vhost_use_symlink': True,
  50. },
  51. }, default='Debian' ),
  52. 'install_from_source': False,
  53. 'install_from_ppa': False,
  54. 'install_from_repo': False,
  55. 'ppa_version': 'stable',
  56. 'package': {
  57. 'opts': {},
  58. },
  59. 'service': {
  60. 'enable': True,
  61. 'opts': {},
  62. },
  63. 'server': {
  64. 'opts': {},
  65. 'config': {
  66. 'worker_processes': 4,
  67. 'events': {
  68. 'worker_connections': 768,
  69. },
  70. 'http': {
  71. 'sendfile': 'on',
  72. 'tcp_nopush': 'on',
  73. 'tcp_nodelay': 'on',
  74. 'keepalive_timeout': '65',
  75. 'types_hash_max_size': '2048',
  76. 'default_type': 'application/octet-stream',
  77. 'access_log': '/var/log/nginx/access.log',
  78. 'error_log': '/var/log/nginx/error.log',
  79. 'gzip': 'off',
  80. 'gzip_disable': '"msie6"',
  81. 'include': [
  82. '/etc/nginx/mime.types',
  83. '/etc/nginx/conf.d/*.conf',
  84. '/etc/nginx/sites-enabled/*',
  85. ],
  86. },
  87. },
  88. },
  89. 'vhosts': {
  90. 'disabled_postfix': '.disabled',
  91. 'symlink_opts': {},
  92. 'rename_opts': {},
  93. 'managed_opts': {},
  94. 'dir_opts': {
  95. 'makedirs': True,
  96. },
  97. 'managed': {},
  98. },
  99. }, merge=True) %}
  100. {% if 'user' not in nginx.server.config %}
  101. {% do nginx.server.config.update({
  102. 'user': nginx.lookup.webuser,
  103. })%}
  104. {% endif %}
  105. {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
  106. {% do nginx.server.config.update({
  107. 'pid': nginx.lookup.pid_file,
  108. })%}
  109. {% endif %}