Browse Source

nginx: cleanup init.sls

Karsten Böddeker 6 years ago
parent
commit
0d76fa0cb4
1 changed files with 4 additions and 3 deletions
  1. 4 3
      nginx/init.sls

+ 4 - 3
nginx/init.sls

@@ -2,7 +2,8 @@
 # Nginx
 #
 
-{% set nginx_pkg = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':nginx:pkg', 'nginx') %}
+{% set node_config = salt['pillar.get']('nodes:' ~ grains.id) %}
+{% set nginx_pkg = node_config.get('nginx:pkg', 'nginx') %}
 
 nginx:
   pkg.installed:
@@ -54,7 +55,7 @@ nginx-cache:
       - cmd: nginx-configtest
 
 # Install website configuration files configured for this node
-{% for website in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':nginx:websites', []) %}
+{% for website in node_config.get('nginx', {}).get('websites', []) %}
 /etc/nginx/sites-enabled/{{website}}:
   file.managed:
     - source: salt://nginx/{{website}}
@@ -65,7 +66,7 @@ nginx-cache:
       - cmd: nginx-configtest
 {% endfor %}
 
-{% if 'frontend' in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
+{% if 'frontend' in node_config.get('roles', []) %}
   {% for domain, config in pillar.get('frontend', {}).items()|sort %}
     {% if 'file' in config %}
 /etc/nginx/sites-enabled/{{domain}}: