0

I have a config.jinja file with below jvm options:

`-Dappdynamics.agent.appName=AP_{{ pillar['region'] }}`

However the AP_{{ pillar['region'] }} varies for different environments. For Dev/Prod it can be AP_{{ pillar['region'] }} and for QA it must be AP without the pillar value. How can I define the appName option with multiple values to achieve above? Any suggestions?

if (pillar['region'] == QA)
   -Dappdynamics.agent.applicationName=ALIP
else
   -Dappdynamics.agent.applicationName=ALIP_{{ pillar['region'] }}
end-if
0

Perhaps a macro might be what you are looking for.

Understanding Jinja:Macros

In the lib.sls example in the link (pasted below), it sets a value contingent on the value of the if statement. I think a similar approach could work for you.

{% macro pythonpkg(pkg) -%}
  {%- if grains['os'] == 'FreeBSD' -%}
    py27-{{ pkg }}
  {%- elif grains['os'] == 'Debian' -%}
    python-{{ pkg }}
  {%- endif -%}
{%- endmacro %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.