I want to include another Jinja2 template in an Ansible context in Jinja2

前端 未结 1 1153
太阳男子
太阳男子 2021-01-02 07:31

I have an Ansible playbook that sets a lot of variables. One the playbooks has this task:

- name: create config file 
  template:
    src: \'templates/main_c         


        
相关标签:
1条回答
  • 2021-01-02 08:17

    You don't need to open a Jinja2 expression ({{ ... }}) to refer to a variable inside a statement ({% ... %}). You can use the variable name directly:

    {% include './templates/' + job + '_steps.j2' %}
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题