Saltstack Official Nginx Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

111 líneas
3.3KB

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