Is it possible to implement remote lookup plugins?
Something like:
`
- name: create .hgrc if necessary
file: path={{ hgrc }} owner={{ user }} state=touch
when: remote(‘file_exists’, ‘{{ hgrc }}’) == False
`
Is it possible to implement remote lookup plugins?
Something like:
`
they are called tasks
name: check exists
stat: path={{hgrc}}
ignore_errors: true
register: hgrcfile
name: create .hgrc if necessary
file: path={{ hgrc }} owner={{ user }} state=touch
when: hgrcfile.failed
Thanks. Tasks are fine, but distracting from logic. Lookup plugins are
just right for these kind of checks, but they only work on controlling
machine, so it would be nice to have a mechanism for remote lookups, no?
No, lookup plugins (except when they implement iterators) are a hack to fill in some rare but important use cases, most notably sourcing file data to the authorized_key module, and a few others. They are rarely used.
I’d use the stat module here.