diff --git a/salt/files/master.d/f_defaults.conf b/salt/files/master.d/f_defaults.conf
index 5aaef11..209c47a 100644
--- a/salt/files/master.d/f_defaults.conf
+++ b/salt/files/master.d/f_defaults.conf
@@ -652,12 +652,12 @@ pillar_roots:
 {%- for dir in roots %}
     - {{ dir }}
 {%- endfor -%}
-{% endfor %}
-{%- elif 'pillar_roots' in cfg_salt -%}
+{%- endfor -%}
+{% elif 'pillar_roots' in cfg_salt -%}
 pillar_roots:
-{%- for name, roots in cfg_salt['pillar_roots']|dictsort -%}
+{%- for name, roots in cfg_salt['pillar_roots']|dictsort %}
   {{ name }}:
-{%- for dir in roots -%}
+{%- for dir in roots %}
     - {{ dir }}
 {%- endfor -%}
 {%- endfor -%}