2014-05-04 20:14:03 +02:00
|
|
|
{% set use_upstart = pillar.get('nginx', {}).get('use_upstart', true) %}
|
|
|
|
{% if use_upstart %}
|
2013-08-21 21:01:51 +02:00
|
|
|
nginx-old-init:
|
|
|
|
file:
|
|
|
|
- rename
|
|
|
|
- name: /usr/share/nginx/init.d
|
|
|
|
- source: /etc/init.d/nginx
|
|
|
|
- require_in:
|
|
|
|
- file: nginx
|
|
|
|
cmd:
|
|
|
|
- wait
|
|
|
|
- name: dpkg-divert --divert /usr/share/nginx/init.d --add /etc/init.d/nginx
|
|
|
|
- require:
|
|
|
|
- module: nginx-old-init
|
|
|
|
- watch:
|
|
|
|
- file: nginx-old-init
|
|
|
|
- require_in:
|
|
|
|
- file: nginx
|
|
|
|
module:
|
|
|
|
- wait
|
|
|
|
- name: cmd.run
|
|
|
|
- cmd: kill `cat /var/run/nginx.pid`
|
|
|
|
- watch:
|
|
|
|
- file: nginx-old-init
|
|
|
|
- require_in:
|
|
|
|
- file: nginx
|
|
|
|
|
|
|
|
nginx-old-init-disable:
|
|
|
|
cmd:
|
|
|
|
- wait
|
|
|
|
- name: update-rc.d -f nginx remove
|
|
|
|
- require:
|
|
|
|
- module: nginx-old-init
|
|
|
|
- watch:
|
|
|
|
- file: nginx-old-init
|
2014-05-04 20:14:03 +02:00
|
|
|
{% endif %}
|
2013-08-21 21:01:51 +02:00
|
|
|
|
|
|
|
nginx:
|
|
|
|
pkg.installed:
|
|
|
|
- name: nginx
|
2014-05-04 20:14:03 +02:00
|
|
|
{% if use_upstart %}
|
2013-08-21 21:01:51 +02:00
|
|
|
file:
|
|
|
|
- managed
|
|
|
|
- name: /etc/init/nginx.conf
|
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 440
|
|
|
|
- source: salt://nginx/templates/upstart.jinja
|
|
|
|
- require:
|
|
|
|
- pkg: nginx
|
|
|
|
- file: nginx-old-init
|
|
|
|
- module: nginx-old-init
|
2014-05-04 20:14:03 +02:00
|
|
|
{% endif %}
|
2013-08-21 21:01:51 +02:00
|
|
|
service:
|
|
|
|
- running
|
|
|
|
- enable: True
|
|
|
|
- restart: True
|
|
|
|
- watch:
|
2014-05-04 20:14:03 +02:00
|
|
|
{% if use_upstart %}
|
2013-08-21 21:01:51 +02:00
|
|
|
- file: nginx
|
2014-05-04 20:14:03 +02:00
|
|
|
{% endif %}
|
2013-08-21 21:01:51 +02:00
|
|
|
- file: /etc/nginx/nginx.conf
|
|
|
|
- file: /etc/nginx/conf.d/default.conf
|
|
|
|
- file: /etc/nginx/conf.d/example_ssl.conf
|
2014-05-04 20:14:03 +02:00
|
|
|
- pkg: nginx
|