From 59c2f8b21fe4fc00b672da764ec4d69637255e51 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Sun, 4 May 2014 11:14:03 -0700 Subject: [PATCH] Add pillar item to disable using upstart-based services Fixes GH saltstack-formulas/nginx-formula#14. --- nginx/common.sls | 2 ++ nginx/package.sls | 10 ++++++++-- pillar.example | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/nginx/common.sls b/nginx/common.sls index a3fd5df..091fdeb 100644 --- a/nginx/common.sls +++ b/nginx/common.sls @@ -7,6 +7,7 @@ file.absent {% endfor %} +{% if pillar.get('nginx', {}).get('use_upstart', true) %} {% set logger_types = ('access', 'error') %} {% for log_type in logger_types %} @@ -36,6 +37,7 @@ nginx-logger-{{ log_type }}: /etc/logrotate.d/nginx: file: - absent +{% endif %} /etc/nginx: file.directory: diff --git a/nginx/package.sls b/nginx/package.sls index 56e992c..147dc07 100644 --- a/nginx/package.sls +++ b/nginx/package.sls @@ -1,4 +1,5 @@ - +{% set use_upstart = pillar.get('nginx', {}).get('use_upstart', true) %} +{% if use_upstart %} nginx-old-init: file: - rename @@ -32,10 +33,12 @@ nginx-old-init-disable: - module: nginx-old-init - watch: - file: nginx-old-init +{% endif %} nginx: pkg.installed: - name: nginx +{% if use_upstart %} file: - managed - name: /etc/init/nginx.conf @@ -48,13 +51,16 @@ nginx: - pkg: nginx - file: nginx-old-init - module: nginx-old-init +{% endif %} service: - running - enable: True - restart: True - watch: +{% if use_upstart %} - file: nginx +{% endif %} - file: /etc/nginx/nginx.conf - file: /etc/nginx/conf.d/default.conf - file: /etc/nginx/conf.d/example_ssl.conf - - pkg: nginx \ No newline at end of file + - pkg: nginx diff --git a/pillar.example b/pillar.example index 6011d87..9f15300 100644 --- a/pillar.example +++ b/pillar.example @@ -1,5 +1,6 @@ nginx: install_from_source: True + use_upstart: True with_luajit: False with_openresty: True modules: