I’ll explain the philosophy first, independent of the lsearch discussion.
This has always been the philosophy of the project, so it should not be shocking – but new folks might not have figured this out before.
So as ansible takes on everything into core, there’s more and more to skim over in documentation, and quickly there’s more to hold in your head.
While this is the natural evolution of organic software, it’s my goal to constrain and unnaturally select things so Ansible stays moving towards where we want it to go.
Ansible must be different, consistent, and minimal in terms of core language, and clean in terms of syntax.
I already see there are cases where people make Ansible content “too clever” and don’t simplify, so in giving more rope, we run the risk of greater inconsistency.
Modules are well categorized already, but my general rule is the longer something takes to explain, the more
confusing it can be, and we need to be more careful in deciding whether we need something like that or not.
Ansible legitimately wants to provide back-pressure against additions that complicate explanations or provide obscure ways to do things.
In most cases, this means providing ways to avoid {{ lookup }}, when there is a cleaner way to represent that syntax.
Syntax is very very important to me.
An individual lookup plugin is potentially bad when it’s hard to explain or would encourage confusing practices, and is too close to the way something already works.
In the case of what you have with the “lsearch”, it seems (currently) totally solved to me by:
vars_files:
{{ hosts[inventory_hostname] }}
And then just defining it as a YAML hash. Data structures already provide the ability to do that kind of lookup.
When I originally read the example for ‘lsearch’, it appeared to be searching for lines in a plain text file, which doesn’t seem like a data entry mechanism we want to encourage.
Maybe I’m misunderstanding the use case, and if so, I need to understand it more.
As for “more modules always being a good thing”, it’s really not always – not when a module is going to raise more questions than it solves – lineinfile is a good one for that
I’m not saying this applies to lsearch but I’m still trying to understand the case for it.
I haven’t come to a decision yet, but the great thing about the modules directory and the configurable plugin paths are that – even if we decide to say no to something – it’s still user
extensible.