Template inheritance.

11 views
Skip to first unread message

Roger Gomez

unread,
Feb 17, 2016, 1:39:20 PM2/17/16
to Ansible Project
Hello everyone,
I'm trying to work with Jinja2 template inheritance and I'm seeing this issue.
#playbook.yml

---
- name: Template inheritance test
  hosts: localhost
  tasks:
  - template:
     src=child.j2
     dest=~/test.cfg

#child.j2

{% extends "base.j2" %}
This is from the original 
{% block my_block %}
{% endblock %}
This is from the original too

#base.j2

this should not be in the output.
{% block my_block %}
This should be in the output
{% endblock %}
this should not be in the output either.

After I run the playbook:

cat test.cfg
this should not be in the output.
this should not be in the output either.

I was expecting to see:

This is from the original 
This should be in the output
This is from the original too

What I'm missing here?
Thanks.
Reply all
Reply to author
Forward
0 new messages