From 0da43d98613d4a4c82ea2c9c76d0797e443315bc Mon Sep 17 00:00:00 2001 From: Travis J Parker Date: Wed, 8 Oct 2014 10:17:06 -0700 Subject: [PATCH] move upstart-related states to their own file --- nginx/common.sls | 32 -------------------------------- nginx/init.sls | 3 +++ nginx/upstart.sls | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 nginx/upstart.sls diff --git a/nginx/common.sls b/nginx/common.sls index 091fdeb..b98dc64 100644 --- a/nginx/common.sls +++ b/nginx/common.sls @@ -7,38 +7,6 @@ file.absent {% endfor %} -{% if pillar.get('nginx', {}).get('use_upstart', true) %} -{% set logger_types = ('access', 'error') %} - -{% for log_type in logger_types %} -/var/log/nginx/{{ log_type }}.log: - file.absent - -nginx-logger-{{ log_type }}: - file: - - managed - - name: /etc/init/nginx-logger-{{ log_type }}.conf - - template: jinja - - user: root - - group: root - - mode: 440 - - source: salt://nginx/templates/upstart-logger.jinja - - context: - type: {{ log_type }} - service: - - running - - enable: True - - require: - - file: nginx-logger-{{ log_type }} - - require_in: - - service: nginx -{% endfor %} - -/etc/logrotate.d/nginx: - file: - - absent -{% endif %} - /etc/nginx: file.directory: - user: root diff --git a/nginx/init.sls b/nginx/init.sls index b2659aa..89cdc30 100644 --- a/nginx/init.sls +++ b/nginx/init.sls @@ -1,5 +1,8 @@ include: - nginx.common +{% if pillar.get('nginx', {}).get('use_upstart', true) %} + - nginx.upstart +{% endif %} {% if pillar.get('nginx', {}).get('user_auth_enabled', true) %} - nginx.users {% endif %} diff --git a/nginx/upstart.sls b/nginx/upstart.sls new file mode 100644 index 0000000..b8ae8e5 --- /dev/null +++ b/nginx/upstart.sls @@ -0,0 +1,28 @@ +{% set logger_types = ('access', 'error') %} + +{% for log_type in logger_types %} +/var/log/nginx/{{ log_type }}.log: + file.absent + +nginx-logger-{{ log_type }}: + file: + - managed + - name: /etc/init/nginx-logger-{{ log_type }}.conf + - template: jinja + - user: root + - group: root + - mode: 440 + - source: salt://nginx/templates/upstart-logger.jinja + - context: + type: {{ log_type }} + service: + - running + - enable: True + - require: + - file: nginx-logger-{{ log_type }} + - require_in: + - service: nginx +{% endfor %} + +/etc/logrotate.d/nginx: + file.absent