From 8c780fa63f066723d6a6923493d052e8e17963be Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 20 Dec 2018 12:37:03 +0100 Subject: [PATCH 1/3] Use home and conf_dir from map.jinja to reduce duplication of constants --- nginx/common.sls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/common.sls b/nginx/common.sls index 93d0972..d26ad81 100644 --- a/nginx/common.sls +++ b/nginx/common.sls @@ -1,7 +1,7 @@ {% from "nginx/map.jinja" import nginx as nginx_map with context %} {% set nginx = pillar.get('nginx', {}) -%} -{% set home = nginx.get('home', '/var/www') -%} -{% set conf_dir = nginx.get('conf_dir', '/etc/nginx') -%} +{% set home = nginx.get('home', nginx_map.home) -%} +{% set conf_dir = nginx.get('conf_dir', nginx_map.conf_dir) -%} {% set conf_template = nginx.get('conf_template', 'salt://nginx/templates/config.jinja') -%} {{ home }}: From 6f5ac946d10586cbe7d98363cd07f169c9805818 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 20 Dec 2018 12:37:46 +0100 Subject: [PATCH 2/3] Add support for SUSE OSes like openSUSE and SLES --- nginx/map.jinja | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nginx/map.jinja b/nginx/map.jinja index b467106..67f93ee 100644 --- a/nginx/map.jinja +++ b/nginx/map.jinja @@ -41,4 +41,25 @@ 'install_prefix': '/usr/local/nginx', 'make_flags': '-j2' }, + 'Suse': { + 'apache_utils': 'apache2-utils', + 'group_action': 'pkg.installed', + 'group_pkg': 'patterns-devel-base-devel_rpm_build', + 'libpcre_dev': 'pcre-devel', + 'libssl_dev': 'openssl-devel', + 'pid_path': '/run/nginx.pid', + 'package': 'nginx', + 'default_user': 'nginx', + 'default_group': 'nginx', + 'disable_before_rename': True, + 'old_init_disable': 'chkconfig --del nginx', + 'use_upstart': False, + 'use_sysvinit': False, + 'home': '/srv/www', + 'conf_dir': '/etc/nginx', + 'log_dir': '/var/log/nginx', + 'sbin_dir': '/usr/sbin', + 'install_prefix': '/usr/local/nginx', + 'make_flags': '-j2' + }, }, grain='os_family', merge=salt['pillar.get']('nginx:lookup'), default='Debian') %} From 42ad7c11d8cbd29555204532e0229d3d0ceec6a4 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 20 Dec 2018 13:19:28 +0100 Subject: [PATCH 3/3] Fix detection of systemd on openSUSE Leap 15.0, the string was systemd.cpython-36 --- nginx/templates/config.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/templates/config.jinja b/nginx/templates/config.jinja index 4c36c3d..3d0a94f 100644 --- a/nginx/templates/config.jinja +++ b/nginx/templates/config.jinja @@ -13,7 +13,7 @@ worker_rlimit_nofile {{ worker_rlimit_nofile }}; {% set error_log_level = nginx.get('error_log',{}).get('level', 'warn') -%} error_log {{ ' '.join([error_log_location, error_log_level]) }}; pid {{ nginx.get('pid', '/var/run/nginx.pid') }}; -{% if salt['test.provider']('service') != 'systemd' -%} +{% if not 'systemd' in salt['test.provider']('service') -%} daemon {{ nginx.get('daemon', 'on') }}; {%- endif %}