|
6 | 6 |
|
7 | 7 | {%- set tplroot = tpldir.split('/')[0] %} |
8 | 8 | {% set pillar_namespace = salt['pillar.get']('{}:pillar:namespace'.format(tplroot), tplroot) %} |
9 | | -{% set nginx = salt['pillar.get'](pillar_namespace, { |
10 | | - 'lookup': salt['grains.filter_by']({ |
11 | | - 'Debian': { |
12 | | - 'package': 'nginx', |
13 | | - 'passenger_package': 'passenger', |
14 | | - 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', |
15 | | - 'service': 'nginx', |
16 | | - 'webuser': 'www-data', |
17 | | - 'conf_file': '/etc/nginx/nginx.conf', |
18 | | - 'server_available': '/etc/nginx/sites-available', |
19 | | - 'server_enabled': '/etc/nginx/sites-enabled', |
20 | | - 'snippets_dir': '/etc/nginx/snippets', |
21 | | - 'server_use_symlink': True, |
22 | | - 'pid_file': '/run/nginx.pid', |
23 | | - 'openssl_package': 'openssl', |
24 | | - }, |
25 | | - 'CentOS': { |
26 | | - 'package': 'nginx', |
27 | | - 'passenger_package': 'passenger', |
28 | | - 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', |
29 | | - 'service': 'nginx', |
30 | | - 'webuser': 'nginx', |
31 | | - 'conf_file': '/etc/nginx/nginx.conf', |
32 | | - 'server_available': '/etc/nginx/conf.d', |
33 | | - 'server_enabled': '/etc/nginx/conf.d', |
34 | | - 'snippets_dir': '/etc/nginx/snippets', |
35 | | - 'server_use_symlink': False, |
36 | | - 'pid_file': '/run/nginx.pid', |
37 | | - 'rh_os_releasever': '$releasever', |
38 | | - 'gpg_check': False, |
39 | | - 'gpg_key': 'http://nginx.org/keys/nginx_signing.key', |
40 | | - 'openssl_package': 'openssl', |
41 | | - }, |
42 | | - 'RedHat': { |
43 | | - 'package': 'nginx', |
44 | | - 'passenger_package': 'passenger', |
45 | | - 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', |
46 | | - 'service': 'nginx', |
47 | | - 'webuser': 'nginx', |
48 | | - 'conf_file': '/etc/nginx/nginx.conf', |
49 | | - 'server_available': '/etc/nginx/conf.d', |
50 | | - 'server_enabled': '/etc/nginx/conf.d', |
51 | | - 'snippets_dir': '/etc/nginx/snippets', |
52 | | - 'server_use_symlink': False, |
53 | | - 'pid_file': '/run/nginx.pid', |
54 | | - 'rh_os_releasever': '$releasever', |
55 | | - 'gpg_check': False, |
56 | | - 'gpg_key': 'http://nginx.org/keys/nginx_signing.key', |
57 | | - 'passenger': { |
58 | | - 'passenger_root': '/usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini', |
59 | | - 'passenger_instance_registry_dir': ' /var/run/passenger-instreg', |
60 | | - 'passenger_ruby': '/usr/bin/ruby', |
61 | | - }, |
62 | | - 'openssl_package': 'openssl', |
63 | | - }, |
64 | | - 'Suse': { |
65 | | - 'package': 'nginx', |
66 | | - 'service': 'nginx', |
67 | | - 'webuser': 'nginx', |
68 | | - 'conf_file': '/etc/nginx/nginx.conf', |
69 | | - 'server_available': '/etc/nginx/vhosts.d', |
70 | | - 'server_enabled': '/etc/nginx/vhosts.d', |
71 | | - 'snippets_dir': '/etc/nginx/snippets', |
72 | | - 'server_use_symlink': False, |
73 | | - 'pid_file': '/run/nginx.pid', |
74 | | - 'gpg_check': True, |
75 | | - 'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_{{ grains.osrelease }}/repodata/repomd.xml.key', |
76 | | - 'openssl_package': 'openssl', |
77 | | - }, |
78 | | - 'Arch': { |
79 | | - 'package': 'nginx', |
80 | | - 'service': 'nginx', |
81 | | - 'webuser': 'http', |
82 | | - 'conf_file': '/etc/nginx/nginx.conf', |
83 | | - 'server_available': '/etc/nginx/sites-available', |
84 | | - 'server_enabled': '/etc/nginx/sites-enabled', |
85 | | - 'snippets_dir': '/etc/nginx/snippets', |
86 | | - 'server_use_symlink': True, |
87 | | - 'openssl_package': 'openssl', |
88 | | - }, |
89 | | - 'Gentoo': { |
90 | | - 'package': 'www-servers/nginx', |
91 | | - 'service': 'nginx', |
92 | | - 'webuser': 'nginx', |
93 | | - 'conf_file': '/etc/nginx/nginx.conf', |
94 | | - 'server_available': '/etc/nginx/sites-available', |
95 | | - 'server_enabled': '/etc/nginx/sites-enabled', |
96 | | - 'snippets_dir': '/etc/nginx/snippets', |
97 | | - 'server_use_symlink': True, |
98 | | - 'openssl_package': 'dev-libs/openssl', |
99 | | - }, |
100 | | - 'FreeBSD': { |
101 | | - 'package': 'nginx', |
102 | | - 'passenger_package': 'passenger', |
103 | | - 'service': 'nginx', |
104 | | - 'webuser': 'www', |
105 | | - 'conf_file': '/usr/local/etc/nginx/nginx.conf', |
106 | | - 'server_available': '/usr/local/etc/nginx/sites-available', |
107 | | - 'server_enabled': '/usr/local/etc/nginx/sites-enabled', |
108 | | - 'snippets_dir': '/usr/local/etc/nginx/snippets', |
109 | | - 'server_use_symlink': True, |
110 | | - 'pid_file': '/var/run/nginx.pid', |
111 | | - }, |
112 | | - }, default='Debian' ), |
113 | | - 'install_from_source': False, |
114 | | - 'install_from_ppa': False, |
115 | | - 'install_from_repo': False, |
116 | | - 'install_from_phusionpassenger': False, |
117 | | - 'ppa_version': 'stable', |
118 | | - 'source_version': '1.10.0', |
119 | | - 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d', |
120 | | - 'source': { |
121 | | - 'opts': {}, |
122 | | - }, |
123 | | - 'package': { |
124 | | - 'opts': {}, |
125 | | - }, |
126 | | - 'service': { |
127 | | - 'enable': True, |
128 | | - 'opts': {}, |
129 | | - }, |
130 | | - 'certificates_path': '/etc/nginx/ssl', |
131 | | - 'dh_param': {}, |
132 | | - 'certificates': {}, |
133 | | - 'server': { |
134 | | - 'opts': {}, |
135 | | - 'config': { |
136 | | - 'worker_processes': 'auto', |
137 | | - 'events': { |
138 | | - 'worker_connections': 512, |
139 | | - }, |
140 | | - 'http': { |
141 | | - 'sendfile': 'on', |
142 | | - 'tcp_nopush': 'on', |
143 | | - 'tcp_nodelay': 'on', |
144 | | - 'keepalive_timeout': '65', |
145 | | - 'types_hash_max_size': '2048', |
146 | | - 'default_type': 'application/octet-stream', |
147 | | - 'access_log': '/var/log/nginx/access.log', |
148 | | - 'error_log': '/var/log/nginx/error.log', |
149 | | - 'gzip': 'off', |
150 | | - 'gzip_disable': '"msie6"', |
151 | | - 'include': [ |
152 | | - 'mime.types', |
153 | | - 'conf.d/*.conf', |
154 | | - 'sites-enabled/*', |
155 | | - ], |
156 | | - }, |
157 | | - }, |
158 | | - }, |
159 | | - 'servers': { |
160 | | - 'disabled_postfix': '.disabled', |
161 | | - 'symlink_opts': {}, |
162 | | - 'rename_opts': {}, |
163 | | - 'managed_opts': { |
164 | | - 'makedirs': True, |
165 | | - }, |
166 | | - 'dir_opts': { |
167 | | - 'makedirs': True, |
168 | | - }, |
169 | | - 'managed': {}, |
170 | | - 'purge_servers_config': False, |
171 | | - }, |
172 | | - 'passenger': { |
173 | | - 'passenger_root': '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini', |
174 | | - 'passenger_ruby': '/usr/bin/ruby', |
175 | | - }, |
176 | | -}, merge=True) %} |
| 9 | + |
| 10 | +{% import_yaml tplroot ~ "/defaults.yaml" as defaults %} |
| 11 | +{% import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} |
| 12 | + |
| 13 | +{% set osfamily = salt['grains.filter_by'](osfamilymap, grain='os_family') or {} %} |
| 14 | +{% do salt['defaults.merge'](defaults.nginx, osfamily) %} |
| 15 | + |
| 16 | +{% set nginx = salt['pillar.get'](pillar_namespace, default=defaults['nginx'], merge=True) %} |
177 | 17 |
|
178 | 18 | {% if 'user' not in nginx.server.config %} |
179 | 19 | {% do nginx.server.config.update({ |
|
0 commit comments