|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- {% macro sls_block(dict) %}
- {% for key, value in dict.items() %}
- - {{ key }}: {{ value|json() }}
- {% endfor %}
- {% endmacro %}
-
- {% set nginx = salt['pillar.get']('nginx:ng', {
- 'lookup': salt['grains.filter_by']({
- 'Debian': {
- 'package': 'nginx',
- 'service': 'nginx',
- 'webuser': 'www-data',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/sites-available',
- 'vhost_enabled': '/etc/nginx/sites-enabled',
- 'vhost_use_symlink': True,
- 'pid_file': '/run/nginx.pid',
- },
- 'CentOS': {
- 'package': 'nginx',
- 'service': 'nginx',
- 'webuser': 'nginx',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/conf.d',
- 'vhost_enabled': '/etc/nginx/conf.d',
- 'vhost_use_symlink': False,
- 'pid_file': '/run/nginx.pid',
- 'rh_os_releasever': '$releasever',
- 'gpg_check': False,
- 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
- },
- 'RedHat': {
- 'package': 'nginx',
- 'service': 'nginx',
- 'webuser': 'nginx',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/conf.d',
- 'vhost_enabled': '/etc/nginx/conf.d',
- 'vhost_use_symlink': False,
- 'pid_file': '/run/nginx.pid',
- 'rh_os_releasever': '$releasever',
- 'gpg_check': False,
- 'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
- },
- 'Suse': {
- 'package': 'nginx',
- 'service': 'nginx',
- 'webuser': 'nginx',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/conf.d',
- 'vhost_enabled': '/etc/nginx/conf.d',
- 'vhost_use_symlink': False,
- 'pid_file': '/run/nginx.pid',
- 'gpg_check': True,
- 'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key'
- },
- 'Arch': {
- 'package': 'nginx',
- 'service': 'nginx',
- 'webuser': 'http',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/sites-available',
- 'vhost_enabled': '/etc/nginx/sites-enabled',
- 'vhost_use_symlink': True,
- },
- 'Gentoo': {
- 'package': 'www-servers/nginx',
- 'service': 'nginx',
- 'webuser': 'nginx',
- 'conf_file': '/etc/nginx/nginx.conf',
- 'vhost_available': '/etc/nginx/sites-available',
- 'vhost_enabled': '/etc/nginx/sites-enabled',
- 'vhost_use_symlink': True,
- },
- }, default='Debian' ),
- 'install_from_source': False,
- 'install_from_ppa': False,
- 'install_from_repo': False,
- 'ppa_version': 'stable',
- 'source_version': '1.10.0',
- 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
- 'source': {
- 'opts': {},
- },
- 'package': {
- 'opts': {},
- },
- 'service': {
- 'enable': True,
- 'opts': {},
- },
- 'server': {
- 'opts': {},
- 'config': {
- 'worker_processes': 4,
- 'events': {
- 'worker_connections': 768,
- },
- 'http': {
- 'sendfile': 'on',
- 'tcp_nopush': 'on',
- 'tcp_nodelay': 'on',
- 'keepalive_timeout': '65',
- 'types_hash_max_size': '2048',
- 'default_type': 'application/octet-stream',
- 'access_log': '/var/log/nginx/access.log',
- 'error_log': '/var/log/nginx/error.log',
- 'gzip': 'off',
- 'gzip_disable': '"msie6"',
- 'include': [
- '/etc/nginx/mime.types',
- '/etc/nginx/conf.d/*.conf',
- '/etc/nginx/sites-enabled/*',
- ],
- },
- },
- },
- 'vhosts': {
- 'disabled_postfix': '.disabled',
- 'symlink_opts': {},
- 'rename_opts': {},
- 'managed_opts': {},
- 'dir_opts': {
- 'makedirs': True,
- },
- 'managed': {},
- },
- }, merge=True) %}
-
- {% if 'user' not in nginx.server.config %}
- {% do nginx.server.config.update({
- 'user': nginx.lookup.webuser,
- })%}
- {% endif %}
-
- {% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
- {% do nginx.server.config.update({
- 'pid': nginx.lookup.pid_file,
- })%}
- {% endif %}
-
|