Hi
While I understand you can in theory put any valid python expression in a playbook, to set a variable, I'm wondering about the elegant and intended way to accomplish something like running a playbook against all webservers (grouped in the inventory I guess), which are of a specific system release and *also* have a specific service running (or maybe a specific file exists in the file system tree)?
My main focus is to understand how to satisfy both those two conditions in a elegant way.
/andreas
Ok, so the primary conditional mechanism in Ansible is still the host selector.
I would create a play for webservers by group, definitely.
You can of course use the 'command/shell' module with 'register' to
set a variable that checks whether the service is running and use
"only_if: ${command_result.rc} == 0" and so on.
If you are already writing your own facts, you could also put that
service runningness into the fact module.
Since it's a python expression you can combine only_ifs with 'and' statements.
Excellent. Then I get how it's supposed to work. Thanks.
-andreas