Using Ansible "when" Statements
Using Ansible “when” statements allows you to set parameters for when a task should play out. I’ve put together some examples of how to use basic when statements that I’ve come across. Booleans (True or False) In the example playbook below, I print “Hello world” when the"test_var" variable is true. In the case below we use the “bool” filter to make test_var evaluated as a boolean (ie true or false), then ensure it’s true: ...