feat(servers_config): passes context to custom source_path
templates
This commit is contained in:
parent
982705f1a6
commit
c835e537fb
@ -27,7 +27,5 @@ nginx_config:
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
- template: jinja
|
- template: jinja
|
||||||
{% if 'source_path' not in nginx.server.config %}
|
|
||||||
- context:
|
- context:
|
||||||
config: {{ nginx.server.config|json(sort_keys=False) }}
|
config: {{ nginx.server.get('config', {})|json(sort_keys=False) }}
|
||||||
{% endif %}
|
|
||||||
|
@ -129,11 +129,9 @@ nginx_server_available_dir:
|
|||||||
- {{ k }}: {{ v }}
|
- {{ k }}: {{ v }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% if 'source_path' not in settings.config %}
|
|
||||||
- context:
|
- context:
|
||||||
config: {{ settings.config|json(sort_keys=False) }}
|
|
||||||
nginx: {{ _nginx|json() }}
|
nginx: {{ _nginx|json() }}
|
||||||
{% endif %}
|
config: {{ settings.get('config',{})|json(sort_keys=False) }}
|
||||||
{% if 'overwrite' in settings and settings.overwrite == False %}
|
{% if 'overwrite' in settings and settings.overwrite == False %}
|
||||||
- unless:
|
- unless:
|
||||||
- test -e {{ server_curpath(server) }}
|
- test -e {{ server_curpath(server) }}
|
||||||
|
@ -119,9 +119,10 @@ nginx:
|
|||||||
## - - -- - - -- -- - - --- -- - -- - - - -- - - - - -- - - - -- - - - -- - ##
|
## - - -- - - -- -- - - --- -- - -- - - - -- - - - - -- - - - -- - - - -- - ##
|
||||||
config:
|
config:
|
||||||
include: 'snippets/letsencrypt.conf'
|
include: 'snippets/letsencrypt.conf'
|
||||||
# IMPORTANT: This option is mutually exclusive with TOFS and the rest of
|
# IMPORTANT: This option is mutually exclusive with TOFS.
|
||||||
# the options; if it is found other options (worker_processes: 4 and so
|
# It uploads the file from source and passes the global `nginx` and the
|
||||||
# on) are not processed and just upload the file from source
|
# `config` dictionnary to the template.
|
||||||
|
# `jinja` is assumed as template type.
|
||||||
source_path: salt://path_to_nginx_conf_file/nginx.conf
|
source_path: salt://path_to_nginx_conf_file/nginx.conf
|
||||||
worker_processes: 4
|
worker_processes: 4
|
||||||
# pass as very first in configuration; otherwise nginx will fail to start
|
# pass as very first in configuration; otherwise nginx will fail to start
|
||||||
@ -278,9 +279,14 @@ nginx:
|
|||||||
available_dir: /etc/nginx/sites-available
|
available_dir: /etc/nginx/sites-available
|
||||||
enabled_dir: /etc/nginx/sites-enabled
|
enabled_dir: /etc/nginx/sites-enabled
|
||||||
config:
|
config:
|
||||||
# IMPORTANT: This field is mutually exclusive with TOFS and other
|
# IMPORTANT: This field is mutually exclusive with TOFS.
|
||||||
# config options, it just uploads the specified file
|
# It uploads the file from source and passes the global `nginx` and the
|
||||||
|
# `config` dictionnary to the template.
|
||||||
|
# `jinja` is assumed as template type.
|
||||||
source_path: salt://path-to-site-file/mysite2
|
source_path: salt://path-to-site-file/mysite2
|
||||||
|
# Example:
|
||||||
|
port: 80 # is passed as `config.port` to template located at `source_path`
|
||||||
|
custom_key: custom_value
|
||||||
|
|
||||||
# Below configuration becomes handy if you want to create custom
|
# Below configuration becomes handy if you want to create custom
|
||||||
# configuration files for example if you want to create
|
# configuration files for example if you want to create
|
||||||
|
Loading…
Reference in New Issue
Block a user