On Mon, 11 Nov 2019 02:48:39 -0800 (PST)
morten hoffmann <
mhoff...@gmail.com> wrote:
> .
> ├── group_vars
> │ ├── artefacts_conf.yml
> │ ├── jdk_wl_conf.yml
> │ ├── configuration_conf.yml
> ├── hosts
> └── templates
> ├── nodemanager_service.j2
>
> my roles are using
> - name: Copy nodemanager systemd script
> template:
> src: "{{nodemanager_service_template}}"
> dest: /lib/systemd/system/nodemanager.service
> mode: 0664
> become: yes
>
> Could not find or access 'nodemanager_service.j2'
(In the case "Could not find 'nodemanager_service.j2')
Quoting from "The magic of ‘local’ paths"
https://docs.ansible.com/ansible/latest/user_guide/playbook_pathing.html#the-magic-of-local-paths
"The paths will be searched from most specific to most general (i.e role
before play). ...
role search path is rolename/{files|vars|templates}/, rolename/tasks/.
play search path is playdir/{files|vars|templates}/, playdir/."
It's possible to use "Special variables" in a path. For example
"playbook_dir", or "role_path". See
https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html
Or, link the "template" directory into any of the paths being searched.
Cheers,
-vlado