Why would a role be able to find a template on one control machine but not another (both control machines are running out of the same git repo, so the playbooks/roles/templates/ansible.cfg are identical)?
If I invoke the playbook on one control machine, it runs as expected; it includes the role, the role finds the template, and everything is happy. But on another control machine, it dies with:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [blah.blah.com]: FAILED! => {"changed": false, "msg": "Could not find or access '/home/blah/t/client/../templates/client_sqlnet_no_ldap.ora.j2' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}
The search path displayed in the error is NOT the path to the role, so the error is correct, but WHY is Ansible failing to look in the documented (Search paths in Ansible — Ansible Community Documentation) role search path (i.e., templates directory under the role)?
At the bottom of the above docs, I see there is a variable named ansible_search_path that allegedly shows the search path, and passing -vvvvv will show the search path. But neither appears to show the template search path.
I’ll try to write a simple role and testcase today.
and are you loading the role itself or using an include_tasks to the file?
Also note that the ‘search path’ shows the main directories searched, you can append ‘vars’, ‘files’ or ‘templates’ depending on the context of the caller.
This is fixed. Very silly mistake. The template is named:
client_sqlnet_ldap.ora.j2
But I was missing an underscore in the name. In this “highly regulated” environment, they use Delinea connection manager for access, and it renders underscores and spaces identically, so I didn’t see it! Ugh.