|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 | # vim: ft=jinja
|
3 | 3 |
|
| 4 | +{#- Determine the type of command being run |
| 5 | + * min: standard call via. master |
| 6 | + * cll: `salt-call` |
| 7 | + * ssh: `salt-ssh` |
| 8 | + * unk: unknown call #} |
| 9 | +{%- if salt['config.get']('__cli') == 'salt-minion' %} |
| 10 | +{%- set cli = 'min' %} |
| 11 | +{%- elif salt['config.get']('__cli') == 'salt-call' %} |
| 12 | +{%- if salt['config.get']('root_dir') == '/' %} |
| 13 | +{%- set cli = 'cll' %} |
| 14 | +{%- else %} |
| 15 | +{%- set cli = 'ssh' %} |
| 16 | +{%- endif %} |
| 17 | +{%- else %} |
| 18 | +{%- set cli = 'unk' %} |
| 19 | +{%- endif %} |
| 20 | + |
4 | 21 | {#- Get the `tplroot` from `tpldir` #}
|
5 | 22 | {%- set tplroot = tpldir.split('/')[0] %}
|
6 | 23 | {#- Start imports as #}
|
7 | 24 | {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
|
8 | 25 | {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
|
9 | 26 | {%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
|
10 | 27 | {%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
|
11 |
| -{%- set _lookup = salt['config.get']('template:lookup', default={}) %} |
12 |
| -{%- set _config = salt['config.get']('template', default={}) %} |
13 | 28 |
|
14 |
| -{%- set template = salt['grains.filter_by'](default_settings, default='template', |
| 29 | +{#- Get lookup and config/pillar depending on type of command being run #} |
| 30 | +{%- if cli == 'min' or cli == 'cll' %} |
| 31 | +{%- set _lookup = salt['config.get'](tplroot ~ ':lookup', default={}, merge='recurse') or {} %} |
| 32 | +{%- set _config = salt['config.get'](tplroot, default={}, merge='recurse') or {} %} |
| 33 | +{%- else %} |
| 34 | +{%- set _lookup = salt['pillar.get'](tplroot ~ ':lookup', default={}, merge=True) or {} %} |
| 35 | +{%- set _config = salt['pillar.get'](tplroot, default={}, merge=True) or {} %} |
| 36 | +{%- endif %} |
| 37 | + |
| 38 | +{%- set template = salt['grains.filter_by'](default_settings, default=tplroot, |
15 | 39 | merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
|
16 | 40 | merge=salt['grains.filter_by'](osmap, grain='os',
|
17 | 41 | merge=salt['grains.filter_by'](osfingermap, grain='osfinger',
|
|
0 commit comments