Ansible Pilot

Ansible troubleshooting - Indentation error

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

Indentation errors are one of the most common Ansible problems. In a live demo, we are going to troubleshoot starting from the error message. We are going to investigate the root cause of the problem and fix it.

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

Error

---
- name: blockinfile module demo
  hosts: all
  become: true
  tasks:
- name: Generate /etc/hosts file
  ansible.builtin.blockinfile:
    state: present
    dest: /etc/hosts
    content: |
            192.168.0.200 demo demo.example.com

Fix

---
- name: blockinfile module demo
  hosts: all
  become: true
  tasks:
  - name: Generate /etc/hosts file
      ansible.builtin.blockinfile:
        state: present
        dest: /etc/hosts
        content: |
                    192.168.0.200 demo demo.example.com

code with ❤️ in GitHub

Recap

Now you know better how to troubleshoot the most common Ansible error about indentation. Subscribe to the YouTube channel, Medium, Website and Twitter to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 100+ Automation Examples For Linux and Windows System Administrator and DevOps

Access the Complete Book and Learn Quick Ansible by 200+ Examples

Want to keep this project going? Please donate

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Trustpilot
Follow me

Subscribe not to miss any new releases

August 2, 2021

FREE Top 10 Best Practices

Top 10 Best Practices of Ansible Automation: save time, reduce errors and stress