commit
8c1ab18ea6
@ -7,6 +7,9 @@
|
|||||||
include:
|
include:
|
||||||
- nginx.ng.config
|
- nginx.ng.config
|
||||||
- nginx.ng.service
|
- nginx.ng.service
|
||||||
|
{% if nginx.snippets is defined %}
|
||||||
|
- nginx.ng.snippets
|
||||||
|
{% endif %}
|
||||||
- nginx.ng.servers
|
- nginx.ng.servers
|
||||||
- nginx.ng.certificates
|
- nginx.ng.certificates
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/sites-available',
|
'server_available': '/etc/nginx/sites-available',
|
||||||
'server_enabled': '/etc/nginx/sites-enabled',
|
'server_enabled': '/etc/nginx/sites-enabled',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': True,
|
'server_use_symlink': True,
|
||||||
'pid_file': '/run/nginx.pid',
|
'pid_file': '/run/nginx.pid',
|
||||||
'openssl_package': 'openssl',
|
'openssl_package': 'openssl',
|
||||||
@ -28,6 +29,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/conf.d',
|
'server_available': '/etc/nginx/conf.d',
|
||||||
'server_enabled': '/etc/nginx/conf.d',
|
'server_enabled': '/etc/nginx/conf.d',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': False,
|
'server_use_symlink': False,
|
||||||
'pid_file': '/run/nginx.pid',
|
'pid_file': '/run/nginx.pid',
|
||||||
'rh_os_releasever': '$releasever',
|
'rh_os_releasever': '$releasever',
|
||||||
@ -44,6 +46,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/conf.d',
|
'server_available': '/etc/nginx/conf.d',
|
||||||
'server_enabled': '/etc/nginx/conf.d',
|
'server_enabled': '/etc/nginx/conf.d',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': False,
|
'server_use_symlink': False,
|
||||||
'pid_file': '/run/nginx.pid',
|
'pid_file': '/run/nginx.pid',
|
||||||
'rh_os_releasever': '$releasever',
|
'rh_os_releasever': '$releasever',
|
||||||
@ -63,6 +66,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/conf.d',
|
'server_available': '/etc/nginx/conf.d',
|
||||||
'server_enabled': '/etc/nginx/conf.d',
|
'server_enabled': '/etc/nginx/conf.d',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': False,
|
'server_use_symlink': False,
|
||||||
'pid_file': '/run/nginx.pid',
|
'pid_file': '/run/nginx.pid',
|
||||||
'gpg_check': True,
|
'gpg_check': True,
|
||||||
@ -76,6 +80,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/sites-available',
|
'server_available': '/etc/nginx/sites-available',
|
||||||
'server_enabled': '/etc/nginx/sites-enabled',
|
'server_enabled': '/etc/nginx/sites-enabled',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': True,
|
'server_use_symlink': True,
|
||||||
'openssl_package': 'openssl',
|
'openssl_package': 'openssl',
|
||||||
},
|
},
|
||||||
@ -86,6 +91,7 @@
|
|||||||
'conf_file': '/etc/nginx/nginx.conf',
|
'conf_file': '/etc/nginx/nginx.conf',
|
||||||
'server_available': '/etc/nginx/sites-available',
|
'server_available': '/etc/nginx/sites-available',
|
||||||
'server_enabled': '/etc/nginx/sites-enabled',
|
'server_enabled': '/etc/nginx/sites-enabled',
|
||||||
|
'snippets_dir': '/etc/nginx/snippets',
|
||||||
'server_use_symlink': True,
|
'server_use_symlink': True,
|
||||||
'openssl_package': 'dev-libs/openssl',
|
'openssl_package': 'dev-libs/openssl',
|
||||||
},
|
},
|
||||||
|
20
nginx/ng/snippets.sls
Normal file
20
nginx/ng/snippets.sls
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# nginx.ng.snippet
|
||||||
|
#
|
||||||
|
# Manages creation of snippets
|
||||||
|
|
||||||
|
{% from 'nginx/ng/map.jinja' import nginx, sls_block with context %}
|
||||||
|
|
||||||
|
nginx_snippets_dir:
|
||||||
|
file.directory:
|
||||||
|
{{ sls_block(nginx.servers.dir_opts) }}
|
||||||
|
- name: {{ nginx.lookup.snippets_dir }}
|
||||||
|
|
||||||
|
{% for snippet, config in nginx.snippets.items() %}
|
||||||
|
nginx_snippet_{{ snippet }}:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ nginx.lookup.snippets_dir }}/{{ snippet }}.conf
|
||||||
|
- source: salt://nginx/ng/files/server.conf
|
||||||
|
- template: jinja
|
||||||
|
- context:
|
||||||
|
config: {{ config|json() }}
|
||||||
|
{% endfor %}
|
@ -75,6 +75,11 @@ nginx:
|
|||||||
enable: True # Whether or not the service will be enabled/running or dead
|
enable: True # Whether or not the service will be enabled/running or dead
|
||||||
opts: {} # this partially exposes parameters of service.running / service.dead
|
opts: {} # this partially exposes parameters of service.running / service.dead
|
||||||
|
|
||||||
|
snippets: # You can use snippets to define often repeated configuration once and include it later
|
||||||
|
letsencrypt: # e.g. this can be included using "- include: 'snippets/letsencrypt.conf'"
|
||||||
|
- location ^~ /.well-known/acme-challenge/:
|
||||||
|
- proxy_pass: http://localhost:9999
|
||||||
|
|
||||||
server:
|
server:
|
||||||
opts: {} # this partially exposes file.managed parameters as they relate to the main nginx.conf file
|
opts: {} # this partially exposes file.managed parameters as they relate to the main nginx.conf file
|
||||||
|
|
||||||
@ -102,7 +107,7 @@ nginx:
|
|||||||
symlink_opts: {} # partially exposes file.symlink params when symlinking enabled sites
|
symlink_opts: {} # partially exposes file.symlink params when symlinking enabled sites
|
||||||
rename_opts: {} # partially exposes file.rename params when not symlinking disabled/enabled sites
|
rename_opts: {} # partially exposes file.rename params when not symlinking disabled/enabled sites
|
||||||
managed_opts: {} # partially exposes file.managed params for managed server files
|
managed_opts: {} # partially exposes file.managed params for managed server files
|
||||||
dir_opts: {} # partially exposes file.directory params for site available/enabled dirs
|
dir_opts: {} # partially exposes file.directory params for site available/enabled and snippets dirs
|
||||||
|
|
||||||
# server declarations
|
# server declarations
|
||||||
# servers will default to being placed in server_available
|
# servers will default to being placed in server_available
|
||||||
@ -139,6 +144,7 @@ nginx:
|
|||||||
- $uri
|
- $uri
|
||||||
- $uri/ =404
|
- $uri/ =404
|
||||||
- test: something else
|
- test: something else
|
||||||
|
- include 'snippets/letsencrypt.conf'
|
||||||
|
|
||||||
# The above outputs:
|
# The above outputs:
|
||||||
# server {
|
# server {
|
||||||
|
Loading…
Reference in New Issue
Block a user