The Ansible playbook debugger

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

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.