Notice how I used the Ansible factansible_facts['distribution']in thewhencondition to test which nodes are running Ubuntu. Also, notice that you don’t need to surround variables with curly brackets when usingwhenconditionals. In the playbook output, notice howTASK [Detect Ubuntu Servers]skipped ...
It would be great if the error messages produced by errant when clauses could be improved by being more specific about the particular error which caused the clause to fail to evaluate. As a motivating example, my playbook had the followi...