Introduction 😇
Ansible automates remote system management and maintains the desired state of the systems. Ansible is an easy IT automation tool that simplifies the deployment of your systems and apps. To deploy and update your applications, avoid writing scripts or custom code. Instead, automate using SSH and a language similar to plain English, with no agents to install on remote systems.

In this article, we will discuss the intro of the Ansible 2.5 Portable Guide.

Playbook 📚
The first topic of the "Ansible 2.5 Porting Guide" series is Playbook. This will help you to learn how to use a Playbook. We will also discuss the types of the Playbook.
Ansible Playbooks are sets of tasks that run against hosts automatically. Host groups make up your Ansible inventory. An Ansible Playbook has modules that each carry out a specific function. Each module provides metadata that defines when, where, and by which user a task is carried out.
Let's discuss some functions in Ansible Playbook:
Dynamic Includes and Attribute Inheritance 🧨
A static import_* would inherit any attributes assigned to it from the tasks inside, but a dynamic include_* would only apply to the include itself.
In Ansible version 2.4, this division was only partially executed. This work has been completed as of Ansible version 2.5, and the separation now works as intended. Attributes that are applied to an include_* task will not be inherited by the tasks inside.
Let's examine this by an example:
Syntax of Including tasks:
- include_tasks: "{{ ansible_distribution }}.yml"
tags:
- distro_include
Syntax of Included file:
- block:
- debug:
msg: "In included file"
- apt:
name: nginx
state: latest
tags:
- distro_include
Fixed handling of keywords and inline variables 🗝️🔡
In the last versions of Ansible, there was a problem with handling keywords and inline variables. The issue was that you could not use the name that is already a keyword. For instance:
roles:
- { role: myrole, name: Mike, othervar: othervalue, become: True}
But this issue is resolved in the updated version of Ansible, i.e., Ansible 2.5. We can now use any keyword as a variable name. See the below example:
roles:
- { role: myrole, vars: {name: Mike, othervar: othervalue}, become: True}
Migrating from with_X to loop 🦅
The loop keyword works best for loops in most situations as opposed to with_X style loops. Instead of using a more complex query or lookup, filters are typically the easiest way to explain the loop syntax.
There are several methods using which you can convert with_ style loops to loop and filters. For example:
🔥 with_list
🔥 with_items
🔥 with_indexed_items
🔥 with_flattened
🔥 with_together
🔥 with_dict
🔥 with_sequence
🔥 with_subelements
🔥 with_nested/with_cartesian
🔥 with_random_choice









