-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
map.jinja
): use pillar.get
for salt-ssh
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=jinja | ||
|
||
{#- Determine the type of command being run | ||
* min: standard call via. master | ||
* cll: `salt-call` | ||
* ssh: `salt-ssh` | ||
* unk: unknown call #} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
myii
Author
Member
|
||
{%- if salt['config.get']('__cli') == 'salt-minion' %} | ||
{%- set cli = 'min' %} | ||
{%- elif salt['config.get']('__cli') == 'salt-call' %} | ||
{%- if salt['config.get']('root_dir') == '/' %} | ||
{%- set cli = 'cll' %} | ||
{%- else %} | ||
{%- set cli = 'ssh' %} | ||
{%- endif %} | ||
{%- else %} | ||
{%- set cli = 'unk' %} | ||
{%- endif %} | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
myii
Author
Member
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{#- Start imports as #} | ||
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} | ||
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} | ||
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %} | ||
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %} | ||
{%- set _lookup = salt['config.get']('template:lookup', default={}) %} | ||
{%- set _config = salt['config.get']('template', default={}) %} | ||
|
||
{%- set template = salt['grains.filter_by'](default_settings, default='template', | ||
{#- Get lookup and config/pillar depending on type of command being run #} | ||
{%- if cli == 'min' or cli == 'cll' %} | ||
{%- set _lookup = salt['config.get'](tplroot ~ ':lookup', default={}, merge='recurse') or {} %} | ||
{%- set _config = salt['config.get'](tplroot, default={}, merge='recurse') or {} %} | ||
This comment has been minimized.
Sorry, something went wrong.
alxwr
Member
|
||
{%- else %} | ||
{%- set _lookup = salt['pillar.get'](tplroot ~ ':lookup', default={}, merge=True) or {} %} | ||
{%- set _config = salt['pillar.get'](tplroot, default={}, merge=True) or {} %} | ||
{%- endif %} | ||
This comment has been minimized.
Sorry, something went wrong.
alxwr
Member
|
||
|
||
{%- set template = salt['grains.filter_by'](default_settings, default=tplroot, | ||
This comment has been minimized.
Sorry, something went wrong. |
||
merge=salt['grains.filter_by'](osfamilymap, grain='os_family', | ||
merge=salt['grains.filter_by'](osmap, grain='os', | ||
merge=salt['grains.filter_by'](osfingermap, grain='osfinger', | ||
|
I'd rather use "minion", "local", "ssh" and "unknown" here, because it's so explicit you won't need to keep that nice definitions table in your mind.