Member-only story

Ansible troubleshooting — Error 102: No Jinja2 in ‘when’ Conditions

How to solve the Ansible Error 102: No Jinja2 in ‘when’

Luca Berton
4 min readOct 31, 2023

Introduction

Ansible is a powerful automation tool that allows you to manage and configure servers and applications using simple YAML-based playbooks. One of the fundamental elements in Ansible playbooks is the ‘when’ clause, which is used to control the flow of tasks based on specific conditions. However, it’s crucial to understand that when conditions are always templated, Ansible enforces a specific structure for these expressions to avoid errors and issues. In this article, we will explore Ansible Error 102, “No Jinja2 in when,” and how to work with ‘when’ conditions properly.

The ‘when’ Clause in Ansible

The ‘when’ clause is an essential feature in Ansible playbooks, allowing you to control the execution of tasks based on specific conditions. These conditions determine whether a task should run or be skipped. To specify conditions, you use the ‘when’ keyword followed by an expression, and Ansible evaluates this expression to determine if the task should be executed.

Understanding the Error

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet