ansible.builtin.first_found (v2.5.6) — lookup

return first file found from list

| "added in version" historical of ansible.builtin"

Authors: Seth Vidal <skvidal@fedoraproject.org>

Install Ansible via pip

Install with pip install ansible==2.5.6

Description

this lookup checks a list of files and paths and returns the full path to the first combination found.

As all lookups, when fed relative paths it will try use the current task's location first and go up the chain to the containing role/play/include/etc's location.

The list of files has precedence over the paths searched. i.e, A task in a role has a 'file1' in the play's relative path, this will be used, 'file2' in role's relative path will not.

Inputs

    
paths:
    description: list of paths in which to look for the files

_terms:
    description: list of file names
    required: true

Outputs

_raw:
  description:
  - path to file found