Hi there,
I'm attempting to configure a variable lookup to a public key file, and am running into some trouble. What confuses me is that the variable substitution works fine in a debug statement, but then blows up in the lookup statement for assigning authorized key values. Here's the general idea;
## provisioning/git.yml (playbook):
---
- { role: git, git_users: [ 'me' ] }
## provisioning/roles/git/tasks/main.yml:
- user: name=git state=present home=/opt/git
- debug: msg={{ '../../users/files/' + item + '.pub' }}
- authorized_key: user=git key={{ lookup('file', '../../users/files/' + item + '.pub') }}
When I run ansible against the git.yml playbook, I end up with the following:
TASK: [debug msg=../../users/files/.pub] **************************************
ERROR: blah/blah/blah/provisioning/roles/users/files/.pub does not exist
I'm really struggling with understanding what I am missing in terms of looping and the lookup functionality. We're using lookups elsewhere with dynamically constructed paths for passwords, and it seems to work like I'd expect. But when I introduce a loop, it falls apart.
Thanks for any pointers to relieve me of my ignorance!
Chris