September 2018
Beginner to intermediate
214 pages
5h 53m
English
We can use the information collected by Ansible about the hosts it manages to personalize tasks to a specific system using Ansible conditions. Not all modules work with every OS. To make a playbook universal, we can add in some settings where some tasks test the facts of the remote host before executing the task. This also helps with reducing the number of playbook scripts by creating scripts that adapt themselves to the system that they are being executed on. As an example, let's try to install the same package with two different names in Debian and Red Hat Linux OS:
---- name: Install python development package on Linux hosts hosts: linuxservers become: yes remote_user: setup gather_facts: true tasks: - name: install ...
Read now
Unlock full access