|
|
|
|
|
|
|
|
file.symlink: |
|
|
file.symlink: |
|
|
{{ sls_block(nginx.servers.symlink_opts) }} |
|
|
{{ sls_block(nginx.servers.symlink_opts) }} |
|
|
- name: {{ server_path(server, state) }} |
|
|
- name: {{ server_path(server, state) }} |
|
|
|
|
|
- makedirs: True |
|
|
- target: {{ server_path(server, anti_state) }} |
|
|
- target: {{ server_path(server, anti_state) }} |
|
|
{%- else %} |
|
|
{%- else %} |
|
|
{%- if deleted == True %} |
|
|
{%- if deleted == True %} |
|
|
|
|
|
|
|
|
- clean: {{ nginx.servers.purge_servers_config }} |
|
|
- clean: {{ nginx.servers.purge_servers_config }} |
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
# Manage the actual server files |
|
|
|
|
|
{% for server, settings in nginx.servers.managed.items() %} |
|
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
|
|
|
# Managed enabled/disabled state for servers |
|
|
# Managed enabled/disabled state for servers |
|
|
{% for server, settings in nginx.servers.managed.items() %} |
|
|
{% for server, settings in nginx.servers.managed.items() %} |
|
|
{% set conf_state_id = 'server_conf_' ~ loop.index0 %} |
|
|
{% set conf_state_id = 'server_conf_' ~ loop.index0 %} |
|
|
|
|
|
|
|
|
}} |
|
|
}} |
|
|
- makedirs: True |
|
|
- makedirs: True |
|
|
- template: jinja |
|
|
- template: jinja |
|
|
- require_in: |
|
|
|
|
|
- service: nginx_service |
|
|
|
|
|
{% if 'source_path' not in settings.config %} |
|
|
{% if 'source_path' not in settings.config %} |
|
|
- context: |
|
|
- context: |
|
|
config: {{ settings.config|json(sort_keys=False) }} |
|
|
config: {{ settings.config|json(sort_keys=False) }} |
|
|
|
|
|
|
|
|
- unless: |
|
|
- unless: |
|
|
- test -e {{ server_curpath(server) }} |
|
|
- test -e {{ server_curpath(server) }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% do server_states.append(conf_state_id) %} |
|
|
|
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
{% do server_states.append(conf_state_id) %} |
|
|
|
|
|
|
|
|
{% if settings.enabled != None %} |
|
|
{% if settings.enabled != None %} |
|
|
{% set status_state_id = 'server_state_' ~ loop.index0 %} |
|
|
{% set status_state_id = 'server_state_' ~ loop.index0 %} |
|
|
|
|
|
|
|
|
- file: {{ conf_state_id }} |
|
|
- file: {{ conf_state_id }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{% if 'deleted' not in settings or ( 'deleted' in settings and settings.deleted == False ) %} |
|
|
|
|
|
{% do server_states.append(status_state_id) %} |
|
|
{% do server_states.append(status_state_id) %} |
|
|
{% endif %} |
|
|
|
|
|
{%- endif %} {# enabled != available_dir #} |
|
|
{%- endif %} {# enabled != available_dir #} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% endfor %} |
|
|
{% endfor %} |