From f3ef626ec4847e00429eb684baeb94f2f91ffbf8 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Wed, 24 Jan 2018 16:44:51 +0100 Subject: [PATCH 1/6] [users.sls] touch /etc/nginx/.htpasswd --- nginx/users.sls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nginx/users.sls b/nginx/users.sls index 34a6672..83ca4e1 100644 --- a/nginx/users.sls +++ b/nginx/users.sls @@ -5,6 +5,10 @@ htpasswd: pkg.installed: - name: {{ nginx.apache_utils }} +touch /etc/nginx/.htpasswd: + cmd.run: + - creates: /etc/nginx/.htpasswd + make sure {{ htauth }} exists: file.exists: - name: {{ htauth }} From 78ddf90f5b188942bc1aab3ffd7ed905fe7d79e7 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Wed, 24 Jan 2018 16:56:43 +0100 Subject: [PATCH 2/6] [users] use {{ htauth }} variable --- nginx/users.sls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/users.sls b/nginx/users.sls index 83ca4e1..8f3a65e 100644 --- a/nginx/users.sls +++ b/nginx/users.sls @@ -5,9 +5,9 @@ htpasswd: pkg.installed: - name: {{ nginx.apache_utils }} -touch /etc/nginx/.htpasswd: +touch {{ htauth }}: cmd.run: - - creates: /etc/nginx/.htpasswd + - creates: {{ htauth }} make sure {{ htauth }} exists: file.exists: From 159f4da4d058d4a9aa9b579e3be22cfab23ffb17 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Fri, 26 Jan 2018 15:37:34 +0100 Subject: [PATCH 3/6] [README] include nginx.ng.certifcates --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 2f61b7d..cf15a6b 100644 --- a/README.rst +++ b/README.rst @@ -83,6 +83,11 @@ Installs nginx from package, from the distribution repositories, the official ng Builds and installs nginx from source. +``nginx.ng.certificates`` +------------------- + +Manages the deployment of nginx certificates. + ``nginx.ng.config`` ------------------- From c5c10478650a6bbc8b91573544babd7e66b97f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20B=C3=A9rtoli?= Date: Tue, 13 Feb 2018 21:27:15 -0300 Subject: [PATCH 4/6] Allow to specify a different passenger config file in nginx.ng --- nginx/ng/map.jinja | 3 +++ nginx/ng/passenger.sls | 2 +- pillar.example | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nginx/ng/map.jinja b/nginx/ng/map.jinja index c166877..c5bb973 100644 --- a/nginx/ng/map.jinja +++ b/nginx/ng/map.jinja @@ -9,6 +9,7 @@ 'Debian': { 'package': 'nginx', 'passenger_package': 'passenger', + 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', 'service': 'nginx', 'webuser': 'www-data', 'conf_file': '/etc/nginx/nginx.conf', @@ -21,6 +22,7 @@ 'CentOS': { 'package': 'nginx', 'passenger_package': 'passenger', + 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', 'service': 'nginx', 'webuser': 'nginx', 'conf_file': '/etc/nginx/nginx.conf', @@ -36,6 +38,7 @@ 'RedHat': { 'package': 'nginx', 'passenger_package': 'passenger', + 'passenger_config_file': '/etc/nginx/conf.d/passenger.conf', 'service': 'nginx', 'webuser': 'nginx', 'conf_file': '/etc/nginx/nginx.conf', diff --git a/nginx/ng/passenger.sls b/nginx/ng/passenger.sls index 6b03430..220056b 100644 --- a/nginx/ng/passenger.sls +++ b/nginx/ng/passenger.sls @@ -26,7 +26,7 @@ passenger_install: passenger_config: file.managed: {{ sls_block(nginx.server.opts) }} - - name: /etc/nginx/conf.d/passenger.conf + - name: {{ nginx.lookup.passenger_config_file }} - source: salt://nginx/ng/files/nginx.conf - template: jinja - context: diff --git a/pillar.example b/pillar.example index b728869..a91ad14 100644 --- a/pillar.example +++ b/pillar.example @@ -51,6 +51,10 @@ nginx: server_available: /etc/nginx/sites-available server_enabled: /etc/nginx/sites-enabled server_use_symlink: True + # If you install nginx+passenger from phusionpassenger in Debian, these values will probably be needed + passenger_package: libnginx-mod-http-passenger + passenger_config_file: /etc/nginx/conf.d/mod-http-passenger.conf + # This is required for RedHat like distros (Amazon Linux) that don't follow semantic versioning for $releasever rh_os_releasever: '6' # Currently it can be used on rhel/centos/suse when installing from repo From 28d106961754ba310156418af8d2d9d4bcfaf226 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Tue, 24 Apr 2018 11:01:29 +0200 Subject: [PATCH 5/6] [nginx/users] add makedirs to htpasswd deploy --- nginx/users.sls | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx/users.sls b/nginx/users.sls index 34a6672..1cdbfd8 100644 --- a/nginx/users.sls +++ b/nginx/users.sls @@ -8,6 +8,7 @@ htpasswd: make sure {{ htauth }} exists: file.exists: - name: {{ htauth }} + - makedirs: True {% for name, user in pillar.get('users', {}).items() %} {% if user['webauth'] is defined -%} From 4da13b9f8bc4f4dc41b33873b9e9b6ea1e51b176 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Tue, 24 Apr 2018 11:20:08 +0200 Subject: [PATCH 6/6] [nginx/users] convert file.present into file.managed with no content --- nginx/users.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/users.sls b/nginx/users.sls index 1cdbfd8..db1414c 100644 --- a/nginx/users.sls +++ b/nginx/users.sls @@ -6,7 +6,7 @@ htpasswd: - name: {{ nginx.apache_utils }} make sure {{ htauth }} exists: - file.exists: + file.managed: - name: {{ htauth }} - makedirs: True