Skip to content

Instantly share code, notes, and snippets.

@chhibber
Created January 14, 2014 06:51
Show Gist options
  • Save chhibber/8414206 to your computer and use it in GitHub Desktop.
Save chhibber/8414206 to your computer and use it in GitHub Desktop.
Salt State File for Nginx
nginx:
pkg:
- installed
service.running:
- pkg: nginx
- watch:
- pkg: nginx
- file: /etc/nginx/nginx.conf
- file: /etc/nginx/mime.types
- file: /etc/nginx/sites-enabled/FOOBAR
- file: /etc/ssl/star.FOOBAR.com.crt
- file: /etc/ssl/star.FOOBAR.com.crt
/etc/nginx/nginx.conf:
file.managed:
- source: salt://nginx/nginx.conf
- require:
- pkg: nginx
/etc/nginx/mime.types:
file.managed:
- source: salt://nginx/mime.types
- require:
- pkg: nginx
/etc/nginx/sites-enabled/FOOBAR:
file.managed:
- template: jinja
- ENV: {{ grains['environment'] }}
- WWW: {{ grains['environment'] }}
{% if grains['environment'] == 'production' %}
- WWW: "www"
{% endif %}
- source: salt://nginx/sites-enabled_FOOBAR
- require:
- pkg: nginx
/etc/ssl/star.FOOBAR.com.key:
file.managed:
- source: salt://nginx/star.FOOBAR.com.key
- mode: 440
/etc/ssl/star.FOOBAR.com.crt:
file.managed:
- source: salt://nginx/star.FOOBAR.com.crt
- mode: 440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment