Skip to content

Instantly share code, notes, and snippets.

@bemeyert
Last active January 11, 2020 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bemeyert/738b86f87ad844d1a352 to your computer and use it in GitHub Desktop.
Save bemeyert/738b86f87ad844d1a352 to your computer and use it in GitHub Desktop.
Saltstack - map.jinja usage fails
{#- 'version' comes only from pillars
'application_dir' - Atlassian puts the string "-standalone" at the end of the extracted application
#}
{%- set jira =
{
'install_dir' : '/opt/jira',
'user' : 'jira',
'group' : 'jira',
'home' : '/data/jira',
'version' : '',
'port' : '8080',
}
%}
{#- update/overwrite 'jira' with pillars #}
{%- do jira.update( salt.pillar.get('jira') ) %}
{#- Now that all data are collected we can assemble application_dir #}
{%- do jira.update(
{
'application_dir': jira.install_dir + '/atlassian-jira-' + jira.version + '-standalone'
}
) %}
{%- from 'global/jira/map.jinja' import jira with context %}
[...]
{#- 'version' comes only from pillars
'application_dir' - Atlassian puts the string "-standalone" at the end of the extracted application
#}
{%- set jira =
{
'install_dir' : '/opt/jira',
'user' : 'jira',
'group' : 'jira',
'home' : '/data/jira',
'version' : '',
'port' : '8080',
'application_dir': install_dir + '/atlassian-jira-' + version + '-standalone'
}
%}
{%- do jira.update( salt.pillar.get('jira') ) %}
[root@salttestvm70 ~]# salt-call state.sls global.jira
[CRITICAL] Rendering SLS 'base:global.jira' failed: Jinja variable 'install_dir' is undefined
/var/cache/salt/minion/files/base/global/jira/map.jinja(4):
---
{#- 'version' comes only from pillars
'application_dir' - Atlassian puts the string "-standalone" at the end of the extracted application
#}
{%- set jira = <======================
{
'install_dir' : '/opt/jira',
'user' : 'jira',
'group' : 'jira',
'home' : '/data/jira',
[...]
---
local:
Data failed to compile:
----------
Rendering SLS 'base:global.jira' failed: Jinja variable 'install_dir' is undefined
/var/cache/salt/minion/files/base/global/jira/map.jinja(4):
---
{#- 'version' comes only from pillars
'application_dir' - Atlassian puts the string "-standalone" at the end of the extracted application
#}
{%- set jira = <======================
{
'install_dir' : '/opt/jira',
'user' : 'jira',
'group' : 'jira',
'home' : '/data/jira',
[...]
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment