Ansible's filters are mainly derived from Jinja2 filters, and all Ansible filters are used to transform and manipulate data (Ansible's variables). In addition to Jinja2 filters, Ansible implements its own filters to augment Jinja2 filters, while also allowing users to define their own custom filters. In this recipe, we will outline how to configure and use Ansible filters to manipulate our input data.
Using Ansible's filters
How to do it...
- Install python3-pip and Python's netaddr library, since we will be using the Ansible IP filter, which requires Python's netaddr library:
# On ubuntu
$ sudo apt-get install python3-pip
# On CentOS
$ sudo yum install python3-pip
$ pip3 install netaddr
- Create a new...