GETIING STARTED WITH ANSIBLE.UTILS COLLECTION

Plugins inside ansible.utils

Plugins are pieces of code that extend the functionality of Ansible. This program runs on the control node. It also provides options and extensions for the Red Hat Ansible Automation Platform’s key functionality. This set of ansible.utils plugins include:

Filter plugins

Data is manipulated by filter plugins. You can extract a specific value, convert data types and formats, conduct mathematical calculations, split and concatenate strings, insert dates and times, and much more with the right filter. Ansible extends Jinja2’s regular filters and provides some specific filter plugins.

Lookup plugins

Ansible-specific extensions to the Jinja2 templating language are lookup plugins. Within your playbooks, you can utilize lookup plugins to access data from other sources (files, databases, key/value stores, APIs, and other services). Lookups, like all templating, run on the Ansible control machine and are assessed. Using the standard templating system, Ansible makes the data supplied by a lookup plugin available. Lookup plugins can be used to populate variables or templates with data from external sources.

Test plugins

Template expressions are evaluated by test plugins and a True or False value is returned. You can use test plugins to implement the logic of your tasks, blocks, plays, playbooks, and roles by using conditionals. Ansible Automation Platform makes advantage of the Jinja standard tests and adds some specific test plugins.

Modules

Modules are the fundamental components of Ansible playbooks. Although the term “module plugins” is not commonly used, a module is a form of a plugin.

Different use cases of Utils

As we all know, ansible.utils include a wide range of plugins and applications. The most typical use cases for ansible.utils are as follows:

  • Validating business logic with validating and testing plugins before publishing settings
  • Using test plugins to audit architectural deposition and layouts
  • Using the get path and to path plugins in an Ansible playbook to manage complex data structures
  • Using test plugins to carry out small network address checks
  • Validate plugins and assess operational state using cli parse

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store