thx, but that failed on missing filters. In any case, I stripped out al for loops and found the problem. The deployer had commented out list items, but did not leave any. So:
foobar: - bar - baz - bor was in the config as: foobar: # - bar # - baz # - bor which meant it wasn't a list anymore, but null instead, and thus None in python... Dick On Thu, 25 Jan 2024 at 17:06, Matt Martz <[email protected]> wrote: > Line 764 in root is referencing the python code that jinja ultimately > generates to run. So there isn't really an easy way to map that back to the > template itself. > > I have a tool that can ingest a jinja template, and print out that python > code. It's possible you might be able to visually understand what the > python code is doing, and trace that back to a line in your jinja template. > You can find it at: > > https://gist.github.com/sivel/6c93326b4cadd127bceb9ca6bb7e204a > > Run like: python j2generated.py < template.j2 > > On Thu, Jan 25, 2024 at 9:36 AM Dick Visser <[email protected]> wrote: > >> with extra debugging: >> >> >> The full traceback is: >> Traceback (most recent call last): >> File >> "/Users/dick.visser/foo/venv/lib/python3.11/site-packages/ansible/template/__init__.py", >> line 1160, in do_template >> res = j2_concat(rf) >> ^^^^^^^^^^^^^ >> File "<template>", line 764, in root >> TypeError: 'NoneType' object is not iterable >> >> During handling of the above exception, another exception occurred: >> >> Traceback (most recent call last): >> File >> "/Users/dick.visser/foo/venv/lib/python3.11/site-packages/ansible/plugins/action/template.py", >> line 150, in run >> resultant = templar.do_template(template_data, >> preserve_trailing_newlines=True, escape_backslashes=False) >> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> File >> "/Users/dick.visser/foo/venv/lib/python3.11/site-packages/ansible/template/__init__.py", >> line 1171, in do_template >> raise AnsibleError("Unexpected templating type error occurred on >> (%s): %s" % (to_native(data), to_native(te))) >> ansible.errors.AnsibleError: Unexpected templating type error occurred on >> ( >> <huge template content> >> >> >> I guessed that "line 764" would be the location in the template, but at >> that place nothing seems relevant.... >> >> On Thu, 25 Jan 2024 at 15:08, Dick Visser <[email protected]> wrote: >> >>> Hii, >>> >>> I have a template that has a lot of variables and control structures. I >>> get an error during the playbook run: >>> >>> fatal: [prod_nagios2]: FAILED! => changed=false >>> msg: |- >>> AnsibleError: Unexpected templating type error occurred on ( >>> <huge template content here> >>> ): 'NoneType' object is not iterable >>> >>> The content of the template is 800 lines, about 36kB, with 100+ >>> variables. >>> Anyone have an idea where to start looking? >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAF8BbLbdUE0ibKfai%2B3%2BKFfwv__oaVYT13gYnZua_5ibHSsy0w%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLbdUE0ibKfai%2B3%2BKFfwv__oaVYT13gYnZua_5ibHSsy0w%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Matt Martz > @sivel > sivel.net > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAD8N0v8tJGS72YDank5ixUKtyFAhaUFcOFT0Bva7Qj2m7i_YBg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAD8N0v8tJGS72YDank5ixUKtyFAhaUFcOFT0Bva7Qj2m7i_YBg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLZ-MgNA1nY%3DU%2ByPXgwgDK43G2YEXcD7s3WV8qEOdLT_LA%40mail.gmail.com.
