Member-only story

Ansible troubleshooting — undefined variable

How to reproduce the `undefined variable` error in Ansible, troubleshooting, and fix to be able to successfully print the value of a variable on screen.

Luca Berton
3 min readNov 18, 2021

Today we’re going to talk about Ansible troubleshooting, specifically about the undefined variable errors.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

demo

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the undefined variable error and how to solve it!

  • underfinedvariable_error.yml
---
- name: debug module demo
hosts: all
tasks:
- name: debug message
ansible.builtin.debug:
msg: "{{ fruit }}"

execution

$ ansible-playbook troubleshooting/undefinedvariable_error.ymlPLAY [file module demo] ***************************************************************************TASK [Gathering Facts] ****************************************************************************

--

--

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