Overwrite existing vhost files on a per vhost granularity

This commit is contained in:
George Robinson 2016-06-05 19:34:53 +01:00
parent 49e085da11
commit 241d8683ed
3 changed files with 2 additions and 8 deletions

View File

@ -14,7 +14,6 @@
'vhost_available': '/etc/nginx/sites-available',
'vhost_enabled': '/etc/nginx/sites-enabled',
'vhost_use_symlink': True,
'vhost_overwrite': True,
'pid_file': '/run/nginx.pid',
},
'CentOS': {
@ -25,7 +24,6 @@
'vhost_available': '/etc/nginx/conf.d',
'vhost_enabled': '/etc/nginx/conf.d',
'vhost_use_symlink': False,
'vhost_overwrite': True,
'pid_file': '/run/nginx.pid',
'rh_os_releasever': '$releasever',
'gpg_check': False,
@ -39,7 +37,6 @@
'vhost_available': '/etc/nginx/conf.d',
'vhost_enabled': '/etc/nginx/conf.d',
'vhost_use_symlink': False,
'vhost_overwrite': True,
'pid_file': '/run/nginx.pid',
'rh_os_releasever': '$releasever',
'gpg_check': False,
@ -53,7 +50,6 @@
'vhost_available': '/etc/nginx/conf.d',
'vhost_enabled': '/etc/nginx/conf.d',
'vhost_use_symlink': False,
'vhost_overwrite': True,
'pid_file': '/run/nginx.pid',
'gpg_check': True,
'gpg_key': 'http://download.opensuse.org/repositories/server:/http/openSUSE_13.2/repodata/repomd.xml.key'
@ -66,7 +62,6 @@
'vhost_available': '/etc/nginx/sites-available',
'vhost_enabled': '/etc/nginx/sites-enabled',
'vhost_use_symlink': True,
'vhost_overwrite': True,
},
'Gentoo': {
'package': 'www-servers/nginx',
@ -76,7 +71,6 @@
'vhost_available': '/etc/nginx/sites-available',
'vhost_enabled': '/etc/nginx/sites-enabled',
'vhost_use_symlink': True,
'vhost_overwrite': True,
},
}, default='Debian' ),
'install_from_source': False,
@ -87,7 +81,6 @@
'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
'source': {
'opts': {},
'modules': {}
},
'package': {
'opts': {},

View File

@ -94,7 +94,7 @@ nginx_vhost_available_dir:
- template: jinja
- context:
config: {{ settings.config|json() }}
{% if nginx.lookup.vhost_overwrite == False %}
{% if 'overwrite' in vhost and vhost.overwrite == False %}
- unless:
- test -e {{ vhost_curpath(vhost) }}
{% endif %}

View File

@ -90,6 +90,7 @@ nginx:
enabled_dir: /tmp/sites-enabled # an alternate directory (not sites-enabled) where this vhost may be found
disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking
enabled: True
overwrite: True # overwrite an existing vhost file or not
# May be a list of config options or None, if None, no vhost file will be managed/templated
# Take server directives as lists of dictionaries. If the dictionary value is another list of