June 2018
Intermediate to advanced
398 pages
9h
English
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 hits an Ubuntu server that uses the apt module, not yum.
First, we will add the following two sections to our inventory file, to group the CentOS and Ubuntu machines in the infra
Read now
Unlock full access