Merge pull request #263 from Irsute/master

feat(add a purge dir option): add the option to purge sites-enable / …
This commit is contained in:
Imran Iqbal 2020-03-31 14:43:50 +01:00 committed by GitHub
commit 07a4bc3e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -162,6 +162,7 @@
'makedirs': True,
},
'managed': {},
'purge_servers_config': False,
},
'passenger': {
'passenger_root': '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini',

View File

@ -83,6 +83,7 @@ nginx_server_enabled_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
- name: {{ nginx.lookup.server_enabled }}
- clean: {{ nginx.servers.purge_servers_config }}
# If enabled and available are not the same, create available
{% if nginx.lookup.server_enabled != nginx.lookup.server_available -%}
@ -90,6 +91,7 @@ nginx_server_available_dir:
file.directory:
{{ sls_block(nginx.servers.dir_opts) }}
- name: {{ nginx.lookup.server_available }}
- clean: {{ nginx.servers.purge_servers_config }}
{%- endif %}
# Manage the actual server files

View File

@ -174,6 +174,9 @@ nginx:
# partially exposes file.directory params for site available/enabled and
# snippets dirs
dir_opts: {}
# let the choice to purge site-available and site-enable folders before add new ones
# (if True it removes all non-salt-managed files)
purge_servers_config: false
#####################