Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [jinja]

Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.

1
vote
1answer
16 views

Saltstack Jinja template pillar merge

I have a several pillars and I am trying to merge them in the same jinja variable {%- import_yaml "server_list_de.yaml" as servers %} {%- import_yaml "server_list_uk.yaml" as servers_uk %} {%- ...
0
votes
0answers
13 views

Need help with massaging data from ansible modules

I have retrieved data from Azure using the azure_rm_*_facts modules, and have ended up with some data (after tweaking) like this: { 'nics': [ { 'fw01port01': { 'ip': '10....
0
votes
1answer
15 views

How to add multiple jvm options in a saltstack jinja?

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 ...
3
votes
1answer
40 views

Configuring Zookeeper from Ansible

I'm trying to configure a Zookeeper Cluster with Ansible. As you might know Zookeeper has two important config files. zookeeper/conf/zoo.cfg I create this file on each cluster member using this ...
3
votes
1answer
3k views

Ansible Jinja template if statement

This is a snippet from my Ansible jinja template which populates an environment specific template. docker_compose_mq: <string-passed from Jenkins> docker_compose_profiles: "string" {% if "{{ ...
1
vote
3answers
155 views

Yaml linting failling when jinja is used

I am using https://yamllint.readthedocs.io/en/stable/index.html to lint my yaml files (used in a saltstack context, and linted by jenkins jobs at every commit), but as reported and explained here, it ...
2
votes
1answer
1k views

Compare Strings to get Unique values in Jinja2

I have a variable with list of node IP's and its respective Availability Zone. seed = { 10.18.13.12 = us-east-1a 10.18.37.93 = us-east-1b 10.18.68.147 = us-east-1a 10.18.21.55 = us-east-1b } ...
1
vote
1answer
34 views

Salt State is running against all servers except one, why?

I recently asked a question here: Is it possible to use multiple if statements in a salt state? Thanks to the answer I have managed to update my state to only check specific files exist on specific ...
2
votes
1answer
2k views

Is it possible to use multiple if statements in a salt state?

I have a Salt state which checks multiple files exist on our webservers, we have 4 webservers and 2 environments so a combined total of 8. This state is applied to all by using a grain 'webserver'. ...
4
votes
1answer
693 views

Is it possible to combine jinja templates in ansible like this is possible with erbs in puppet?

It is possible to include a subtemplate in another Puppet template. <%= scope.function_template("subtemplate.erb") %>
5
votes
1answer
1k views

Securely grab minion ID in pillar top file template?

I found this SLS file in a pillar top.sls targeting example: top.sls: base: '*': - hostspecificsls hostspecificsls: # See https://groups.google.com/forum/#!topic/salt-users/UWfP6bMe6F8 {% ...
14
votes
2answers
5k views

How to examine Jinja output in Saltstack?

I have a templated SLS in Salt I'm trying to build, but it's emitting invalid syntax, which is resulting in errors such as: my-minion-id: - State 'system' in SLS 'network' is not formed as a list ...
7
votes
2answers
432 views

Constructing Dependencies from a Pillar in Saltstack

I'm trying to create a dummy state in Salt to pull dependencies from a list derived from a pillar. In my top.sls file, I have: base: '*': - components Then, in components.sls, I have: {% if '...