Member-only story

Ansible troubleshooting — Syntax Error

Let’s troubleshoot together the Ansible fatal error “Syntax Error while loading YAML” to find the offending lines in our playbook code, the root cause, fix a missing quote, and verify the resolution is working.

Luca Berton
3 min readSep 15, 2021

Today we’re going to talk about Ansible troubleshooting and specifically about Syntax 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 syntax error and how to solve it!

  • report.txt
test report.txt
  • syntax_error.yml
---
- name: win_copy module demo
hosts: all
become: false
gather_facts: false
vars:
source: "report.txt"
destination: "Desktop/report.txt"
tasks:
- name: copy report.txt
ansible.windows.win_copy:
src: "{{ source }}"
dest: "{{ destination }}

output:

$ ansible-playbook -i win/inventory troubleshooting/syntax_error.yml

--

--

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