Ansible not accepting When condition

when is indented too much. Put it at the level where module name is mentioned.

Thankyou I fixed it. Is there any syntax highlighter recommended for Ansible

https://docs.ansible.com/ansible/latest/community/other_tools_and_programs.html

There is "YAML mode" available in Emacs (not perfect unfortunately)
https://www.emacswiki.org/emacs/YamlMode

"HighlightIndentation" is useful too
https://www.emacswiki.org/emacs/HighlightIndentation

Thankyou it was insightful to learn about other tools Best Regards