How to ignore jinja2 braces {{}} in j2 template file

77 views
Skip to first unread message

Mahesh Nalavade

unread,
Jul 22, 2022, 9:05:01 AM7/22/22
to Ansible Project
Hi Team,

I have below template
variables:
=============
sector: test
project: test


template:-
==============

{% if ( env  == 'preprod') or ( env  == 'prod') %}
  role_bindings:
    - name: XXXXX
      subjects:
        - "{{k8s_sup_subjects['{{ sector }}-{{ project }}']}}"
{% else %}
  role_bindings:
    - name: XXXX
      subjects:
        - "{{k8s_sup_subjects['{{ sector }}-{{ project }}']}}"
{% endif %}

problem:
===========
i want to ignore the {{ from "{{k8s_sup_subjects['{{ sector }}-{{ project }}']}}"

expected output
==================
- "{{k8s_sup_subjects['test-test']}}"


Abhijeet Kasurde

unread,
Jul 22, 2022, 10:01:44 AM7/22/22
to ansible...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cdd446e5-65bd-496e-9e21-f6e5ef1b2a48n%40googlegroups.com.


--
Thanks,
Abhijeet Kasurde
Reply all
Reply to author
Forward
0 new messages