hortonworks / ansible-hortonworks

Ansible playbooks for deploying Hortonworks Data Platform and DataFlow using Ambari Blueprints
Apache License 2.0
248 stars 253 forks source link

Commit 4d41737 brokes the dynamic_blueprint.j2 template #29

Closed mstrullu closed 6 years ago

mstrullu commented 6 years ago

Hello,

Such as mentionned by @fredrikhgrelland Commit 4d41737 brokes the dynamic_blueprint.j2 template.

TASK [ambari-blueprint : Upload the blueprint and the cluster creation template] *** failed: [master-2] (item={u'dest': u'/tmp/astcluster_blueprint', u'src': u'blueprint_dynamic.j2'}) => {"changed": false, "item": {"dest": "/tmp/astcluster_blueprint", "src": "blueprint_dynamic.j2"}, "msg": "AnsibleError: template error while templating string: expected token '=', got '.'.

My file playbooks/group_vars/ambari-server is configure like that:

`#############################

blueprint configuration

#############################

blueprint_name: '{{ cluster_name }}_blueprint' # the name of the blueprint as it will be stored in Ambari blueprint_file: 'blueprint_dynamic.j2' # the blueprint JSON file - 'blueprint_dynamic.j2' is a Jinja2 template that generates the required JSON blueprint_dynamic: # properties for the dynamic blueprint - these are only used by the 'blueprint_dynamic.j2' template to generate the JSON

Thanks for your help,

alexandruanghel commented 6 years ago

This originally sounded bizarre as I've tested this quite a bit before pushing and it was working for me.

It turns out I'm using a Jinja2 feature that is only available in Jinja2.10: https://github.com/pallets/jinja/commit/c2ee56db0e5e3a5a321285a85550958955b88d02#diff-8f76b794bd641afb7bd92eba51f332f3

Please update your Jinja2 to 2.10, this version was released in Nov 2017 :)

mstrullu commented 6 years ago

You are right, after upgrading jinja2, problem disappear.

Thanks.