ansiblelintansible-lint

Ansible Lint trailing space


I have performed ansible lint check on the below yml code, even though there is no trailing spaces, I'm receiving trailing whitespace warning for the indentation that has been given. Can you advice on how that can be overcome

---
- hosts: localhost
  gather_facts: false
  tasks:
  - block:
    - name: Which python is running
      command: "which python"
      register: result

    - name: Debug
      debug: var=result.stdout

ansible-lint test.yml

[201] Trailing whitespace
test.yml:1
---

[201] Trailing whitespace
test.yml:2
- hosts: localhost

[201] Trailing whitespace
test.yml:3
 gather_facts: false

and so on for each line


Solution

  • I'll make wild guesses here (and will remove my answer if I'm totally wrong):

    If my guesses are correct, you are suffering from a bug which has been fixed.

    Upgrade ansible-lint and your problem should go away:

    pip install --upgrade ansible-lint
    

    In case there is no fast path to perform this upgrade, you can always transform your line endings to LF only until your admin can do the job.