In this part of the chapter, we will look at some of the advanced features in the Ansible playbook.
Understanding Ansible conditions, handlers, and loops
Designing conditions
An Ansible playbook can execute tasks (or skip them) based on the results of specific conditions inside the task—for example, when you want to install packages on a specific family of operating systems (Debian or CentOS), or when the operating system is a particular version, or even when the remote hosts are virtual, not bare metal. This can be done by using the when clause inside of the task.
Let's enhance the previous playbook and limit the openssh-server installation to only CentOS based systems, so that it does not give an error when it...