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

map.jinja 3.9KB

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