vhost_overwrite option for nginx.ng state

This commit is contained in:
George Robinson 2016-05-25 16:53:52 +01:00
parent 6cab66306b
commit 9ff1a8f22d
2 changed files with 10 additions and 0 deletions

View File

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

View File

@ -94,6 +94,10 @@ nginx_vhost_available_dir:
- template: jinja - template: jinja
- context: - context:
config: {{ settings.config|json() }} config: {{ settings.config|json() }}
{% if nginx.lookup.vhost_overwrite == False %}
- unless:
- test -e {{ vhost_curpath(vhost) }}
{% endif %}
{% do vhost_states.append(conf_state_id) %} {% do vhost_states.append(conf_state_id) %}
{% endif %} {% endif %}