I’m setting up my local machine provisioning on Ubuntu, and I find myself doing this pattern a lot for software that’s not managed by APT/PPA. E.g. Google Chrome.
So I check to see if the file exists using a find, store that result in a variable, and then use it in my when to decide if ansible should do the chrome install process (which is an include).
Is there an easier way to check if a file exists? Maybe a simple lookup plugin that I’m missing?
Just figured I would ask the question, as I’m doing this a lot, and thought there may be a more efficient way.
lookup plugins are evaluated server side and are not a fit in this case.
I would probably key it off the return code of a find, using .rc vs .stdout
You could definitely write a custom facts module that would make setting all those variables a lot easier, and it could encapsulate all of those checks.