Summary
In this chapter, we have adapted the WordPress installation playbook we wrote in Chapter 5, Deploying WordPress, to target multiple operating systems. We did this by using Ansible’s built-in auditing module to determine which operating system the playbook is running against and running only the tasks that will work on the two target distributions.
While targeting multiple Linux distributions is one use for the approach we have taken with the conditions we have been using, I am sure that you will already have some ideas on how you could use some of the logic we used in your projects, such as bootstrapping different software based on the role on a virtual machine host, etc.
Additionally, this approach is beneficial when publishing your roles to Ansible Galaxy, as discussed in Chapter 2, Exploring Ansible Galaxy, by making the operating system agnostic.
You may have noticed so far that we have been targeting Linux virtual machines; in the next chapter, we will...