On Jul 05, Fabian Reiners wrote:
currently I'm seeing weird effects of non-resolvable variables
again.
I'm using Debops v1.0.1 with some cherry-picks not related to ferm and
apache2. Using the example playbook from [1] and no specific inventory
variables, I encounter the following error:
TASK [debops.apache : Create conf-available snippets]
***********************************************************************
[WARNING]: Unable to find 'lookup/ferm__fix_dependent_rules.j2' in
expected paths (use -vvvvv to see paths)
failed: [test] (item={'value': True, 'key':
u'local-debops_apache'}) =>
{"ansible_loop_var": "item", "changed": false,
"item": {"key":
"local-debops_apache", "value": true}, "msg":
"AnsibleError: An
unhandled exception occurred while templating '{{ lookup(\"template\",
\"lookup/ferm__fix_dependent_rules.j2\", convert_data=False) | from_json
}}'. Error was a <class 'ansible.errors.AnsibleError'>, original
message: An unhandled exception occurred while running the lookup plugin
'template'. Error was a <class 'ansible.errors.AnsibleError'>,
original
message: the template file lookup/ferm__fix_dependent_rules.j2 could not
be found for the lookup"}
...
As I imagine the problem is as follows:
* In this task the template
ansible-debops/ansible/roles/debops.apache/templates/etc/apache2/conf-available/local-debops_apache.conf.j2
is evaluated which has import-statements for macros
* As the imports are called "with context" Jinja2 tries to pass down the
full variable context and evaluates "ferm__fix_dependent_rules", which
has not been used before
* This obviously fails, because the referenced template could not be located
Do any of you guys have an idea on how to circumvent this error?
Maybe by making sure, that ferm__fix_dependent_rules is used in the ferm
role?
Can I prevent debops.apache from evaluating vars from debops.ferm?
Hello!
This is a common occurence with Jinja version lower than 2.10. Check which one
you have and upgrade it to at least 2.10, that should fix the issue. Let me
know if that helped.
Cheers,
Maciej