nginx-formula/nginx/passenger.sls
Hannah Wolfe e07b5582dc feat(passenger): inc config, snippets, servers, etc
- currently you're forced to define extra states if you opt to install nginx with passenger,
 if you want the same outcome for passenger and nginx installs with equivalent config
- passenger is an extra module on top of nginx, makes no sense to end up with less configuration by default
2019-07-23 14:14:34 +01:00

53 lines
1.3 KiB
Plaintext

# nginx.passenger
#
# Manages installation of passenger from repo.
# Requires install_from_phusionpassenger = True
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ '/map.jinja' import nginx, sls_block with context %}
{%- from tplroot ~ '/libtofs.jinja' import files_switch with context %}
{% if salt['grains.get']('os_family') in ['Debian', 'RedHat'] %}
include:
- nginx.pkg
- nginx.config
- nginx.service
{%- if nginx.snippets is defined %}
- nginx.snippets
{%- endif %}
- nginx.servers
- nginx.certificates
passenger_install:
pkg.installed:
- name: {{ nginx.lookup.passenger_package }}
- require:
- pkg: nginx_install
- require_in:
- service: nginx_service
/etc/nginx/passenger.conf:
file.absent:
- require:
- pkg: passenger_install
passenger_config:
file.managed:
{{ sls_block(nginx.server.opts) }}
- name: {{ nginx.lookup.passenger_config_file }}
- source: {{ files_switch(['nginx.conf'],
'passenger_config_file_managed'
)
}}
- template: jinja
- context:
config: {{ nginx.passenger|json() }}
- watch_in:
- service: nginx_service
- require_in:
- service: nginx_service
- require:
- file: /etc/nginx/passenger.conf
- pkg: passenger_install
{% endif %}