Table of contents
1.
Introduction😇
2.
Playbook📖
3.
Deprecated😃
4.
Modules🦾
4.1.
Deprecation Notice📄
4.2.
Noteworthy Module Changes 🔃
5.
Plugins🔌
5.1.
Deprecation Notice
5.2.
Noteworthy Plugin Changes
6.
Dynamic Inventory Script🧨
7.
Frequently Asked Questions🤔
7.1.
How do you execute a role?
7.2.
What is the default module in Ansible?
7.3.
What is the Ansible action plugin?
8.
Conclusion🎉
Last Updated: Mar 27, 2024
Easy

Ansible 2.6 Porting Guide

Author Sagar Mishra
1 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction😇

Ansible is a software program that automates Cross platform computer service in a simple but effective way. It is mainly designed for IT experts, who use it for app deployment and almost every other task a systems leader performs weekly or daily. Ansible is simple to deploy as it does not require any other security infrastructure or agent software.

logo

In this blog, we will discuss Ansible 2.6 Porting Guide in detail. Here we will learn the main differences that occurred in the newer version of Ansible.

ninja talks

Playbook📖

The first topic of the "Ansible 2.6 Porting Guide" series is Playbook. This will help you to learn how to use a Playbook. 

Ansible Playbooks offer a reusable, repeatable, simple configuration management and Multi machine deployment system. It is well suited to deploying complex apps. Write a playbook and set it under source control if you need to execute a task with Ansible more than once. Then you can easily use the Playbook to push out new setups or confirm the configuration of remote systems.

In the earlier version of Ansible (version 2.5), the deprecated task option always_run was available. But, there is a check_mode:no inplace of this in the newer version.

Deprecated😃

Our next topic in the "Ansible 2.6 Porting Guide" series is Deprecated. Here we will learn about the changes made in the latest version of Ansible.

The oif_prefix and oif_source properties are no longer supported by the nxos_igmp_interface module. Instead, we can use the ois_ps parameter with a dictionary of prefixes and source to values.

Modules🦾

Our next topic in the "Ansible 2.6 Porting Guide" series is Modules. Let's discuss the main changes in the modules.

Ansible modules are distinct units of code that can be used from the command line or in a task from a playbook. The modules are also task or library plugins in Ansible. Ansible comes preloaded with a number of modules known as the module library, which can be run on local servers or distant hosts using playbooks.

Deprecation Notice📄

There are a lot of modules in Ansible Playbook. And all of these keep changing on every update. So please note that, In the upcoming update for Ansible version 2.10, it will remove some of its modules. Now, you can update your Playbook as per your needs The modules that are being removed are listed below. 

📢 User can use k8s in place of k8s_raw.

 

📢 User can use k8s in place of openshift_raw.

 

📢 User can use k8s_scale in place of openshift_scale.

Noteworthy Module Changes 🔃

These are firewalls, load balancers, AWS, Azure, private cloud, OpenStack, and security configuration. There are some top ansible modules that are often used to automate different tasks. But there are some changes in modules. 

The modules that are being removed or changed are listed below.

⭐ You can use the state: latest in place of the upgrade module option for win_chocolatey as this module is removed in the new version of Ansible.

 

⭐ We have to use the free form dictionary in place of the win_iis_webappool module as it does not support a string for the attributes module option anymore.

 

⭐ Use HKCC instead of HCCC since this is the right hive path because the win_regedit module no more automatically changes it to HKCC.

 

⭐ When src is supplied with a state other than hard or link, the file_module now produces a deprecation warning as it is only intended to be useful with those. This might affect users who rely on an unreliable interaction between src and other states to move files into a subdirectory. Consider this:

$ ansible localhost -m file -a 'path=/var/lib src=/tmp/ state=directory'

 

You can also simply write the whole path. Refer to the below syntax:

$ ansible localhost -m file -a 'path=/tmp/lib state=directory'

 

⭐ There is some addition in Ansible 2.6 also, like k8s_raw and openshift_raw module. These modules have been aliased to the new k8s module.

 

⭐ The k8s module will not accept resources that have had their subkeys snake_cased. The k8s_raw and openshift_raw modules were used as a possible workaround.

 

⭐ Resources with api_versions that vary from the shortened version in the Kubernetes Python client may not be accepted by the k8s module. The correct full Kubernetes api_version for a resource should now be specified.

 

⭐ The k8s scale module now supports scalable OpenShift objects like DeploymentConfig.

 

⭐ OpenStack modules no longer use the shade library. OpenStacksdk is used in its place. No more steps are needed as openstacksdk should already be present as a dependency for shade.

Plugins🔌

plugins

In the "Ansible 2.6 Porting Guide" series, our next topic is Plugins. Here we will learn about the changes made in the latest version of Ansible.

Ansible's core feature is enhanced by plugins with logic and services that are free to all modules. Many helpful plugins are included with Ansible collections, and creating your own is simple. Let's discuss the changes that are coming in the updated version.

Deprecation Notice

The openshift module is removed from Ansible 2.10, but no worries, you can use the k8s in place of openshift. Hence update your Playbook.

Noteworthy Plugin Changes

🟡 All Kubernetes resources, including those from aggregated API servers and custom resource definitions, are now supported by the k8s lookup plugin. Included in this are all OpenShift tools.

 

🟡 The k8s lookup plugin will no longer remove Secrets from Ansible return values. You can use the no_log task block argument to stop a task's secret values from being logged.

 

🟡 Resources with the api_version altered to match the reduced version in the Kubernetes Python client might not be accepted by the k8s lookup plugin. The proper full Kubernetes api_version for a resource should now be specified.

 

Note: There is no change in porting custom scripts and networking.

Dynamic Inventory Script🧨

In the "Ansible 2.6 Porting Guide" series, our last topic is Dynamic Inventory Script. Here we will learn about the changes made in the latest version of Ansible.

The inventory database on AWX or Red Hat AAP syncs with your dynamic inventory sources. It enables online and REST access to the results. Also, it has a graphical inventory editor if you want a GUI for managing dynamic inventory.

The changes in Dynamic Inventory Script are as follows:

🔷 The name of contrib/inventory/openstack.py is changed, and the new name is contrib/inventory/openstack_inventory.py.
 

🔷 The name openstack.py is now the same as import from openstack. So, changing your 

OpenStack dynamic inventory file name is suggested to avoid conflict between them.

Frequently Asked Questions🤔

faqs

How do you execute a role?

A role cannot be carried out directly. There is no explicit setting in a role that specifies which host it will apply to. Top Level playbooks link the hosts in your inventory file and the roles that need to be assigned to them.

What is the default module in Ansible?

The module defaults keyword can be utilized at the play, block, and task levels. Any explicitly stated module parameters in a task will override any set default for that module argument. By specifying an empty dict, you can stop any earlier defaults set for a module.

What is the Ansible action plugin?

Action plugins work with modules to carry out the tasks specified by playbook tasks. They run automatically in the background, completing tasks required for running modules. The "normal" action plugin is utilized for modules without an action plugin.

Conclusion🎉

We have discussed the topic of the Ansible 2.6 Porting Guide. In detail, we have seen topics like Playbook, Deprecated, Modules, and Plugins and discussed their changes.

We hope this blog has helped you enhance your knowledge of the "Ansible 2.6 Porting Guide." If you want to learn more, check out our articles Ansible - AWXAnsible - GalaxyAnsible - Templates, and many more on our platform Coding Ninjas Studio.

But suppose you have just started your learning process and are looking for questions from tech giants like Amazon, Microsoft, Uber, etc. In that case, you must look at the problemsinterview experiences, and interview bundles for placement preparations.

However, you may consider our paid courses to give your career an edge over others!

Happy Learning!

thankyou

Live masterclass