Hello
I'm trying to use jinja template as value for ansible.builtin.lineinfile module in role task.
named
├── tasks
│ ├── config.yml
│ ├── main.yml
├── templates
│ ├── option.ji2
│ ├── view.ji2
ansible.builtin.lineinfile:
path: "{{ test_dir }}{{ named_config_file['path'] }}"
regex: "{{ item['key'] }}"
line: "{% set option = item %}{% include 'option.ji2' %}"
validate: named-checkconf %s
loop: "{{ named_options | dict2items }}"
Unfortunately ansible throws TemplateNotFound error:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: jinja2.exceptions.TemplateNotFound: option.ji2
Using relative or absolute path to template doesn't help.
templates/option.ji2
../templates/option.ji2
/home/ansible/.ansible/roles/named/templates/option.ji2
Any ideas why ansible can't find/use template option.ji2?