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_config.j2'
dest: "{{ tmp_dir }}/main_config.json"
The template main_config.j2
writes strings that are defined as variables in the parent Ansible playbooks and tasks.
I want to include another Jinja2 template based on a value of an Ansible variable.
{% include "./templates/configurations.j2" %},
{% include "./templates/security.j2" %},
{% include './templates/' + {{ job }} + '_steps.j2' %}
job
is a Ansible variable set in a parent playbook.
This is not working. What could be the problem?
template
module? – Giff