2014-05-16 00:06:48 +02:00
|
|
|
{% macro sls_block(dict) %}
|
|
|
|
{% for key, value in dict.items() %}
|
2017-03-23 18:54:16 +01:00
|
|
|
- {{ key }}: {{ value|json(sort_keys=False) }}
|
2014-05-16 00:06:48 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% set nginx = salt['pillar.get']('nginx:ng', {
|
|
|
|
'lookup': salt['grains.filter_by']({
|
|
|
|
'Debian': {
|
|
|
|
'package': 'nginx',
|
2017-06-24 15:43:25 +02:00
|
|
|
'passenger_package': 'passenger',
|
2018-02-14 01:27:15 +01:00
|
|
|
'passenger_config_file': '/etc/nginx/conf.d/passenger.conf',
|
2014-05-16 00:06:48 +02:00
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'www-data',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/sites-available',
|
|
|
|
'server_enabled': '/etc/nginx/sites-enabled',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': True,
|
2015-06-20 20:13:02 +02:00
|
|
|
'pid_file': '/run/nginx.pid',
|
2017-07-11 11:31:17 +02:00
|
|
|
'openssl_package': 'openssl',
|
2014-05-16 00:06:48 +02:00
|
|
|
},
|
2015-10-26 16:36:25 +01:00
|
|
|
'CentOS': {
|
|
|
|
'package': 'nginx',
|
2017-06-24 15:43:25 +02:00
|
|
|
'passenger_package': 'passenger',
|
2018-02-14 01:27:15 +01:00
|
|
|
'passenger_config_file': '/etc/nginx/conf.d/passenger.conf',
|
2015-10-26 16:36:25 +01:00
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'nginx',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/conf.d',
|
|
|
|
'server_enabled': '/etc/nginx/conf.d',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': False,
|
2015-10-26 16:36:25 +01:00
|
|
|
'pid_file': '/run/nginx.pid',
|
|
|
|
'rh_os_releasever': '$releasever',
|
|
|
|
'gpg_check': False,
|
|
|
|
'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
|
2017-07-11 11:31:17 +02:00
|
|
|
'openssl_package': 'openssl',
|
2015-10-26 16:36:25 +01:00
|
|
|
},
|
2014-05-16 00:06:48 +02:00
|
|
|
'RedHat': {
|
|
|
|
'package': 'nginx',
|
2017-06-24 15:43:25 +02:00
|
|
|
'passenger_package': 'passenger',
|
2018-02-14 01:27:15 +01:00
|
|
|
'passenger_config_file': '/etc/nginx/conf.d/passenger.conf',
|
2014-05-16 00:06:48 +02:00
|
|
|
'service': 'nginx',
|
2014-11-08 00:29:50 +01:00
|
|
|
'webuser': 'nginx',
|
2014-05-16 00:06:48 +02:00
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/conf.d',
|
|
|
|
'server_enabled': '/etc/nginx/conf.d',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': False,
|
2015-08-14 04:40:55 +02:00
|
|
|
'pid_file': '/run/nginx.pid',
|
2015-05-14 02:00:12 +02:00
|
|
|
'rh_os_releasever': '$releasever',
|
2016-02-24 11:11:42 +01:00
|
|
|
'gpg_check': False,
|
|
|
|
'gpg_key': 'http://nginx.org/keys/nginx_signing.key',
|
2017-06-24 15:43:25 +02:00
|
|
|
'passenger': {
|
|
|
|
'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
|
|
|
|
'passenger_instance_registry_dir': ' /var/run/passenger-instreg',
|
|
|
|
'passenger_ruby': '/usr/bin/ruby',
|
|
|
|
},
|
2017-07-11 11:31:17 +02:00
|
|
|
'openssl_package': 'openssl',
|
2014-05-16 00:06:48 +02:00
|
|
|
},
|
2015-03-08 21:23:26 +01:00
|
|
|
'Suse': {
|
|
|
|
'package': 'nginx',
|
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'nginx',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/conf.d',
|
|
|
|
'server_enabled': '/etc/nginx/conf.d',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': False,
|
2015-06-20 20:13:02 +02:00
|
|
|
'pid_file': '/run/nginx.pid',
|
2016-02-24 11:11:42 +01:00
|
|
|
'gpg_check': True,
|
2017-07-11 11:31:17 +02:00
|
|
|
'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key',
|
|
|
|
'openssl_package': 'openssl',
|
2015-06-20 20:13:02 +02:00
|
|
|
},
|
|
|
|
'Arch': {
|
|
|
|
'package': 'nginx',
|
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'http',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/sites-available',
|
|
|
|
'server_enabled': '/etc/nginx/sites-enabled',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': True,
|
2017-07-11 11:31:17 +02:00
|
|
|
'openssl_package': 'openssl',
|
2015-03-08 21:23:26 +01:00
|
|
|
},
|
2015-08-15 12:25:03 +02:00
|
|
|
'Gentoo': {
|
|
|
|
'package': 'www-servers/nginx',
|
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'nginx',
|
|
|
|
'conf_file': '/etc/nginx/nginx.conf',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_available': '/etc/nginx/sites-available',
|
|
|
|
'server_enabled': '/etc/nginx/sites-enabled',
|
2017-08-30 00:26:31 +02:00
|
|
|
'snippets_dir': '/etc/nginx/snippets',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': True,
|
2017-07-11 11:31:17 +02:00
|
|
|
'openssl_package': 'dev-libs/openssl',
|
2015-08-15 12:25:03 +02:00
|
|
|
},
|
2017-12-12 21:08:06 +01:00
|
|
|
'FreeBSD': {
|
|
|
|
'package': 'nginx',
|
|
|
|
'passenger_package': 'passenger',
|
|
|
|
'service': 'nginx',
|
|
|
|
'webuser': 'www',
|
|
|
|
'conf_file': '/usr/local/etc/nginx/nginx.conf',
|
|
|
|
'server_available': '/usr/local/etc/nginx/sites-available',
|
|
|
|
'server_enabled': '/usr/local/etc/nginx/sites-enabled',
|
2016-10-19 23:35:38 +02:00
|
|
|
'server_use_symlink': True,
|
2017-12-12 21:08:06 +01:00
|
|
|
'pid_file': '/var/run/nginx.pid',
|
2015-08-15 12:25:03 +02:00
|
|
|
},
|
2014-05-16 00:06:48 +02:00
|
|
|
}, default='Debian' ),
|
2014-08-12 04:01:38 +02:00
|
|
|
'install_from_source': False,
|
|
|
|
'install_from_ppa': False,
|
2015-03-08 21:23:26 +01:00
|
|
|
'install_from_repo': False,
|
2017-06-24 15:43:25 +02:00
|
|
|
'install_from_phusionpassenger': False,
|
2015-02-10 20:59:49 +01:00
|
|
|
'ppa_version': 'stable',
|
2016-05-09 17:31:29 +02:00
|
|
|
'source_version': '1.10.0',
|
|
|
|
'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
|
|
|
|
'source': {
|
|
|
|
'opts': {},
|
|
|
|
},
|
2014-05-16 00:06:48 +02:00
|
|
|
'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': [
|
2017-12-12 21:08:06 +01:00
|
|
|
'mime.types',
|
|
|
|
'conf.d/*.conf',
|
|
|
|
'sites-enabled/*',
|
2014-05-16 00:06:48 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2016-10-19 23:35:38 +02:00
|
|
|
'servers': {
|
2014-05-16 00:06:48 +02:00
|
|
|
'disabled_postfix': '.disabled',
|
|
|
|
'symlink_opts': {},
|
|
|
|
'rename_opts': {},
|
2017-12-26 23:37:01 +01:00
|
|
|
'managed_opts': {
|
|
|
|
'makedirs': True,
|
|
|
|
},
|
2014-05-16 00:06:48 +02:00
|
|
|
'dir_opts': {
|
|
|
|
'makedirs': True,
|
|
|
|
},
|
2014-05-19 19:04:43 +02:00
|
|
|
'managed': {},
|
2014-05-16 00:06:48 +02:00
|
|
|
},
|
2017-06-24 15:43:25 +02:00
|
|
|
'passenger': {
|
|
|
|
'passenger_root': '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini',
|
|
|
|
'passenger_ruby': '/usr/bin/ruby',
|
|
|
|
},
|
2014-07-03 22:40:15 +02:00
|
|
|
}, merge=True) %}
|
2014-05-16 00:06:48 +02:00
|
|
|
|
|
|
|
{% if 'user' not in nginx.server.config %}
|
|
|
|
{% do nginx.server.config.update({
|
|
|
|
'user': nginx.lookup.webuser,
|
|
|
|
})%}
|
|
|
|
{% endif %}
|
2015-06-20 20:13:02 +02:00
|
|
|
|
|
|
|
{% if 'pid' not in nginx.server.config and 'pid_file' in nginx.lookup %}
|
|
|
|
{% do nginx.server.config.update({
|
|
|
|
'pid': nginx.lookup.pid_file,
|
|
|
|
})%}
|
|
|
|
{% endif %}
|
|
|
|
|
2017-06-24 15:43:25 +02:00
|
|
|
{% if salt['grains.get']('os_family') == 'RedHat' %}
|
|
|
|
{% do nginx.passenger.update({
|
|
|
|
'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini',
|
|
|
|
'passenger_instance_registry_dir': '/var/run/passenger-instreg',
|
|
|
|
})%}
|
|
|
|
{% if salt['grains.get']('osfinger') == 'CentOS-6' %}
|
|
|
|
{% do nginx.server.config.update({
|
|
|
|
'pid': '/var/run/nginx.pid',
|
|
|
|
})%}
|
|
|
|
{% do nginx.passenger.update({
|
|
|
|
'passenger_root': '/usr/lib/ruby/1.8/phusion_passenger/locations.ini',
|
|
|
|
})%}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|