ITADN

line replacement of paperless-ngx config file fails on content in paperless_ngx_conf_filename_format

#241Closedborismw 创建于 2025-05-26
B
borismwcommented
Steps to reproduce: - define a storage path template with placeholders, e.g. `'{% raw %}{{ created_year_short }}-{{ correspondent }}-{{ title }}{% endraw %}'` in variable `paperless_ngx_conf_filename_format` - execute role What happens: The role execution fails because `created_year_short` variable does not exist. --- Hi 👋🏾, again thanks this ansible role. It made settings up paperless-ngx easy, event though documentation of the bare-metal route is a bit scarce. I ran into problems when defining a `paperless_ngx_conf_filename_format` as mentioned above. It seems that even when wrapped between `{% raw %}...{% endraw %}` the `ansible.builtin.lineinfile` task interprets the paperless-ngx specific placeholde syntax as Jinja variable expressions and tries to expand them. This of course leads to an error because the paperless-ngx specific text templates are not known to ansible. I found out that by escaping the loop entry for `paperless_ngx_conf_filename_format` in the `Write the paperless-ngx config file` task in `tasks/paperless_ngx/configuration.yml` like so ``` - pngx_var: PAPERLESS_FILENAME_FORMAT role_var: "{{ '{{' }} paperless_ngx_conf_filename_format {{ '}}' }}" ``` fixes the problem. But same as the issue I filed a few days ago I do not know if this solution fits in. However I will open up a PR soon. EDIT: see PR #242
关闭于 2025-09-02 1 条评论