Ansible has a debugger built in. Let's take a look at how you can build this into your playbook by creating a simple playbook with an error. As we have just mentioned it, we are going to write a playbook that uses the say module. The playbook itself looks as follows:
---
- hosts: localhost
gather_facts: false
debugger: "on_failed"
vars:
message: "The task has completed and all is well"
voice: "Daniel"
tasks:
- name: Say a message on your Ansible host
say:
msg: "{{ massage }}"
voice: "{{ voice }}"
There are two things to point out: the first being the mistake. As you can see, we are defining a variable named message, but when we come to use it the task, I have made a typo and entered massage instead. Luckily, as I am developing the playbook, I have instructed Ansible...