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.
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] ****************************************************************************