File lookup

What is the expected behaviour if a file lookup fails? I have an authorized_key task:

  • name: Key for ansible user
    authorized_key: user=ansible key=“{{ lookup(‘file’, ‘./ansible_key.pub’) }}”

but I moved it into a different folder, and the path is no longer correct. I would expect this to explode, but instead I got green (unchanged).

The source suggests there should be an error (I’ve never seen a for…else before, you learn something new every day!), but it seems to be getting swallowed somewhere.

Can you file a bug for this one?

There are cases where lookups should NOT return an error when they can’t find things, but this one likely should.

The problem is in a bit of corner cases, where a lookup is used to build a path to a vars_file or crazy things, so we’ll have to be a little careful - but those are not mainstream cases and this is.

Done, thanks.