however I get empty contents of lookup call while debug for the pgsql_ssh_key returns proper value. Seems like lookup wants to pick up my pgsql_ssh_key under roles/pgsql/files, but I’d like to keep it top-level (other roles will be using it). What did I miss?
It won’t look in the playbook root when inside a role, no. Sorry I mispoke on that one.
You can path the src as {{ lookup(‘file’, playbook_dir + ‘/filename’) }} if you want this, and it will find things there using the (derived) path of the playbook root.
Ansible will look in the root if you are not using roles.